Multiplayer movement
I watched the multiplayer tutorial from youtube, and everything else works but the movement. Player isn't defined anywhere in the tutorial (which I copied word to word) but it still wants to draw the sprites at player.x and player.y.
OK, in your init, create 2 player objects like this
init = function()
//The two players are defined as objects.
player = object
x = -70
y = 0
width = 32
height = 32
speed = 3
end
player2 = object
x = 70
y = 0
width = 32
height = 32
speed = 3
end
end
update = function()
//the two movements
if keyboard.UP then
player.y += player.speed
elsif keyboard.DOWN then
player.y -= player.speed
elsif keyboard.LEFT then
player.x -= player.speed
elsif keyboard.RIGHT then
player.x += player.speed
end
if keyboard.T then
player2.y += player2.speed
elsif keyboard.G then
player2.y -= player2.speed
elsif keyboard.F then
player2.x -= player2.speed
elsif keyboard.H then
player2.x += player2.speed
end
end
draw = function()
//Monify the icon, not your real sprite name
screen.clear("rgb(85,255,198)")
screen.drawSprite("icon", player.x, player.y, player.width, player.height)
screen.drawSprite("icon", player2.x, player2.y, player2.width, player2.height)
end