Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Graphics 1920,1080,16,1
- SetBuffer
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;insert giant array here
- Global mapx = 77
- Global mapy = 44
- Global readinfo = 1
- Dim array(mapx,mapy)
- If readinfo = 1 Then Read array(x,y)
- Global tile0 = LoadImage("sandtile.png")
- Global tile1 = LoadImage("tile0.png")
- ;;;;;;;player;;;;;;
- Global player = LoadImage("player.png")
- Global px = 75
- Global py = 75
- Global speed = 8
- Global dir = 0
- Global gravity# = .5
- Global vx# = .5
- While Not KeyHit(1)
- update()
- render()
- Wend
- Function update()
- updateplayer()
- updatecollision()
- End Function
- Function render()
- Cls
- drawmap()
- drawplayer()
- Flip
- End Function
- Function updateplayer()
- If KeyDown(205) Then
- px = px + speed
- dir = 1
- ElseIf KeyDown(203) Then
- px = px - speed
- dir = 2
- Else
- dir = 0
- EndIf
- py = py + gravity
- gravity = gravity + vx
- If KeyHit(200) Then
- gravity = - 10
- EndIf
- If py > 1020 Then
- py = 1020
- EndIf
- End Function
- Function updatecollision()
- End Function
- Function drawplayer()
- DrawImage(player,px,py)
- End Function
- Function drawmap()
- For y = 1 To mapy
- For x = 1 To mapx
- If array(x,y) = 0 Then
- DrawImage(tile0,x*25-25,y*25-25)
- ElseIf array(x,y) = 1 Then
- DrawImage(tile1,x*25-25,y*25-25)
- EndIf
- Next
- Next
- readinfo = 0
- End Function
Advertisement
Add Comment
Please, Sign In to add comment