Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --temple tombs
- --by cupps
- --to do list:
- --box pushing
- titlescreen=true
- --player spawn
- function _init()
- curlevel={
- x = 0,
- y = 0,
- }
- bud={
- x=24,
- y=64,
- }
- end
- --title screen stuff
- function title_screen()
- _update=title_update
- _draw=title_draw
- end
- function mgetcurlev(x,y)
- return mget(x+curlevel.x,
- y+curlevel.y)
- end
- function msetcurlev(x,y)
- mset(x+curlevel.x,y+curlevel.y)
- end
- --flag functions
- function flag(x,y)
- local tilex=((x-(x%8))/8)
- local tiley=((y-(y%8))/8)
- if (mgetcurlev(tilex,tiley) == (1))then
- if bud.direction == false then
- curlevel.x+=16
- if curlevel.x == 16 and curlevel.y == 0 then
- bud.x=24
- bud.y=96
- end
- if curlevel.x == 32 and curlevel.y == 0 then
- bud.x=16
- bud.y=104
- end
- if curlevel.x == 48 and curlevel.y == 0 then
- bud.x=16
- bud.y=48
- end
- if curlevel.x == 64 and curlevel.y == 0 then
- bud.x=24
- bud.y=24
- end
- end
- end
- end
- --coin functions
- function coin(x,y)
- local tilex=((x-(x%8))/8)
- local tiley=((y-(y%8))/8)
- if (mgetcurlev(tilex,tiley) == (2))then
- msetcurlev(tilex,tiley,0)
- sfx(1)
- end
- end
- --wall functions
- function solid(x,y)
- local tilex = ((x - (x % 8)) / 8)
- local tiley = ((y - (y % 8)) / 8)
- if (fget(mgetcurlev(tilex,tiley),0))then
- return true
- else
- return false
- end
- end
- function _update()
- --title screen acrivation
- if titlescreen == true then
- if btn(2) then
- titlescreen = false
- end
- else
- if not bud.direction then
- if (btnp(0)) bud.direction = "left" bud.sprite=15
- if (btnp(1)) bud.direction = "right" bud.sprite=13
- if (btnp(2)) bud.direction = "up" bud.sprite=14
- if (btnp(3)) bud.direction = "down" bud.sprite=12
- end
- --movement
- if bud.direction=="left" then
- if(solid(bud.x-1,bud.y) == false) then
- bud.x-=4
- else
- bud.direction = false
- end
- end
- coin(bud.x,bud.y)
- flag(bud.x,bud.y)
- if bud.direction=="right" then
- if(solid(bud.x+8,bud.y) == false) then
- bud.x+=4
- else
- bud.direction = false
- end
- end
- if bud.direction=="up" then
- if(solid(bud.x,bud.y-1) == false) then
- bud.y-=4
- else
- bud.direction = false
- end
- end
- if bud.direction=="down" then
- if(solid(bud.x,bud.y+8) == false) then
- bud.y+=4
- else
- bud.direction = false
- end
- end
- end
- end
- function _draw()
- --titlescreen creating
- if titlescreen == true then
- cls()
- map (112,48)
- print("created by cupps",34,70,2)
- print("press ⬆️ to start",32,96,7)
- else
- cls()
- --coordinate debug info
- --level 1 spawn
- map(curlevel.x, curlevel.y)
- spr(bud.sprite or 12,bud.x,bud.y)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement