Log In  


Okay. So, I am brand spankin' new to coding. I am not quite sure what the proper lingo is.

I am attempting to create a sandbox game, but I have no idea how to make it so that when players reach the edge of the playable screen, they can then continue on into a new screen. "Space Delivery!" and "Carmina's World" accomplishes this.

Please let me know if I am not articulating this properly. Any help is appreciated.

This is all of the code I currently have:

player = {}
player.x = 60
player.y = 60
player.sprite = 0
player.speed = 1
player.moving = false
player.timer = 1 

function movex()

		player.moving = true
		player.sprite += 1
		if player.sprite > 2 then
					player.sprite = 0
		end
end

function movey()
		player.moving = true
		player.sprite += 1
		if player.sprite > 18 then
					player.sprite = 16
		end
end

function _update()
		player.moving = false

		if btn(0) then
				player.x -= player.speed
				movex()
		elseif btn(1) then
				player.x += player.speed
				movex()
		elseif btn(2) then
				player.y -= player.speed
				movey()
		elseif btn(3) then
				player.y += player.speed
				movey()
		end
				if not player.moving then
				player.sprite = 16
		end
				if not player.moving then
				player.timer = player.timer+1
		end
				if player.timer >=30 then
				player.sprite = 3
		end
				if player.timer >=60 then
				player.sprite = 16
				player.timer = 0
		end
				if player.moving then
				player.timer = 0 
		end
end

function _draw()
		map(0,0,0,0,16,8)
		map(0,0,0,64,16,8)
		spr (player.sprite, player.x, player.y)
end




[Please log in to post a comment]