07-14-2014, 07:11 PM
New gamdev lounge.
EDIT: oops i forgot to actually include programming stuff...
here have some code from a rock paper scissors game i made a while back with love2d
im still learning
Quote:Don't be the "idea guy"
"Idea guys" are like the guys who make Pokemon splices or edit Megaman sprites. That means nobody wants to hear about your "Legend of Angry Pokemoncraft Bros. 2 Deluxe: Kirby's Revenge" game idea. If you want to be taken seriously then take game design and development seriously.
303031313030303030303131303130313030313130303131303031313030303030303131303130313030313130313131303031313030303030303131303130313030313130313030303031313030303030303131303131313030313130303030303031313030303030303131303130313030313130313031303031313030303030303131303130313030313130303131303031313030303030303131303130313030313130303030303031313030303030303131303130303030313131303030303031313030303030303131303130313030313130313030303031313030303030303131303131303030313130313031303031313030303030303131303130313030313130313031303031313030303030303131303130313030313130303131303031313030303030303131303130313030313130313031303031313030303030303131303130313030313130303031303031313030303030303131303130313030313130313031303031313030303030303131303130313030313130303130303031313030303030303131303130313030313130303030303031313030303030303131303130303030313131303030303031313030303030303131303130313030313130313031303031313030303030303131303130313030313130313031303031313030303030303131303130313030313130313030303031313030303030303131303130303030313131303031303031313030303030303131303130313030313130313031303031313030303030303131303130313030313130303031303031313030303030303131303130313030313130313031303031313030303030303131303130313030313130303130303031313030303030303131303130313030313130313030303031313030303030303131303130313030313130303131303031313030303030303131303130313030313130313030303031313030303030303131303130313030313130303130303031313030303030303131303130313030313130303030303031313030303030303131303130303030313131303030303031313030303030303131303130313030313130313030303031313030303030303131303130303030313131303031303031313030303030303131303130313030313130303030303031313030303030303131303130303030313131303030303031313030303030303131303130313030313130313030303031313030303030303131303131303030313130313131303031313030303030303131303130313030313130313030303031313030303030303131303131313030313130303030303031313030303030303131303130313030313130313031303031313030303030303131303130313030313130303130303031313030303030303131303130313030313130303030303031313030303030303131303130303030313131303030303031313030303030303131303130313030313130313030303031313030303030303131303131313030313130303030303031313030303030303131303130313030313130313030303031313030303030303131303130313030313130313030303031313030303030303131303130313030313130303030303031313030303030303131303130303030313131303030303031313030303030303131303130313030313130313031303031313030303030303131303130313030313130303130303031313030303030303131303130313030313130313030303031313030303030303131303130313030313130313131303031313030303030303131303130313030313130313030303031313030303030303131303131303030313131303030303031313030303030303131303130313030313130313030303031313030303030303131303130313030313130303131303031313030303030303131303130313030313130303030303031313030303030303131303131303030313131303031
here have some code from a rock paper scissors game i made a while back with love2d
Code:
function love.load()
playerDecision = nil
playerHasDecided = 0
opponentDecision = nil
turn = 1
outcome = nil -- 1 = win, 2 = lose, 3 = draw
math.randomseed(os.time())
math.random()
math.random()
end
function love.update(dt)
--Opponent AI
if opponentDecision == nil then
if playerDecision ~= nil then
opponentDecision = math.random(1,3)
end
end
--
--Win or Loss Decision
if playerHasDecided == 1 then
--Rock
if playerDecision == 1 then
if opponentDecision == 1 then
outcome = 3
end
if opponentDecision == 2 then
outcome = 2
end
if opponentDecision == 3 then
outcome = 1
end
end
--Paper
if playerDecision == 2 then
if opponentDecision == 1 then
outcome = 1
end
if opponentDecision == 2 then
outcome = 3
end
if opponentDecision == 3 then
outcome = 2
end
end
--Scissors
if playerDecision == 3 then
if opponentDecision == 1 then
outcome = 2
end
if opponentDecision == 2 then
outcome = 1
end
if opponentDecision == 3 then
outcome = 3
end
end
end
--
end
function love.keypressed(key)
if turn == 1 then
if playerHasDecided == 0 then
if key == "1" then
playerDecision = 1
playerHasDecided = 1
end
end
end
if turn == 1 then
if playerHasDecided == 0 then
if key == "2" then
playerDecision = 2
playerHasDecided = 1
end
end
end
if turn == 1 then
if playerHasDecided == 0 then
if key == "3" then
playerDecision = 3
playerHasDecided = 1
end
end
end
if key == "r" then
love.load()
love.update(dt)
love.draw()
end
if key == "q" then
love.event.push("quit")
end
end
function love.draw()
love.graphics.setBackgroundColor(255,255,255)
--Main Stuff
love.graphics.setColor(0,0,0)
if playerDecision == nil then
love.graphics.print("Rock, Paper, or Scissors?",0,0,0,2,2)
love.graphics.print("Press 1 for Rock, Press 2 for Paper, or 3 for Scissors!",0,25,0,2,2)
end
if playerDecision == 1 then
love.graphics.print("You picked Rock!",0,0,0,2,2)
end
if playerDecision == 2 then
love.graphics.print("You picked Paper!",0,0,0,2,2)
end
if playerDecision == 3 then
love.graphics.print("You picked Scissors!",0,0,0,2,2)
end
if opponentDecision == 1 then
love.graphics.print("Opponent Picked Rock!",0,30,0,2,2)
end
if opponentDecision == 2 then
love.graphics.print("Opponent Picked Paper!",0,30,0,2,2)
end
if opponentDecision == 3 then
love.graphics.print("Opponent Picked Scissors!",0,30,0,2,2)
end
--Telling you if you won or lost
if outcome == 1 then
love.graphics.print("You win!",0,60,0,3,3)
end
if outcome == 2 then
love.graphics.print("You Lose!",0,60,0,3,3)
end
if outcome == 3 then
love.graphics.print("Draw!",0,60,0,3,3)
end
if outcome ~= nil then
love.graphics.print("Press R to Restart",0,120,0,2,2)
love.graphics.print("Press Q to Quit",0,150,0,2,2)
end
--
--[[Testing
love.graphics.print("turn =",450,0)
love.graphics.print(turn,500,0)
love.graphics.print("playerDecision =",510,0)
if playerDecision ~= nil then
love.graphics.print(playerDecision,620,0)
else
love.graphics.print("nil",620,0)
end
love.graphics.print("opponentDecision =",450,15)
if opponentDecision ~= nil then
love.graphics.print(opponentDecision,590,15)
else
love.graphics.print("nil",590,15)
end
--]]
end