Guest User

Untitled

a guest
Feb 19th, 2013
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Graphics 1920,1080,16,1
  2. SetBuffer
  3.  
  4. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;insert giant array here
  5.  
  6. Global mapx = 77
  7. Global mapy = 44
  8. Global readinfo = 1
  9.  
  10. Dim array(mapx,mapy)
  11. If readinfo = 1 Then Read array(x,y)
  12.  
  13. Global tile0 = LoadImage("sandtile.png")
  14. Global tile1 = LoadImage("tile0.png")
  15.  
  16. ;;;;;;;player;;;;;;
  17.  
  18. Global player = LoadImage("player.png")
  19. Global px = 75
  20. Global py = 75
  21. Global speed = 8
  22. Global dir = 0
  23.  
  24. Global gravity# = .5
  25. Global vx# = .5
  26.  
  27. While Not KeyHit(1)
  28.  
  29.     update()
  30.     render()
  31.    
  32. Wend
  33.  
  34. Function update()
  35.  
  36.     updateplayer()
  37.     updatecollision()
  38.  
  39. End Function
  40.  
  41. Function render()
  42.  Cls
  43.  
  44.     drawmap()
  45.     drawplayer()
  46.    
  47.  Flip
  48. End Function
  49.  
  50. Function updateplayer()
  51.  
  52.     If KeyDown(205) Then
  53.             px = px + speed
  54.             dir = 1
  55.         ElseIf KeyDown(203) Then
  56.             px = px - speed
  57.             dir = 2
  58.         Else
  59.             dir = 0
  60.     EndIf
  61.  
  62.         py = py + gravity
  63.         gravity = gravity + vx
  64.        
  65.         If KeyHit(200) Then
  66.             gravity = - 10
  67.         EndIf
  68.        
  69.         If py > 1020 Then
  70.             py = 1020
  71.         EndIf
  72.  
  73. End Function
  74.  
  75. Function updatecollision()
  76.  
  77.  
  78.  
  79. End Function
  80.  
  81. Function drawplayer()
  82.  
  83.     DrawImage(player,px,py)
  84.  
  85. End Function
  86.  
  87. Function drawmap()
  88.  
  89. For y = 1 To mapy
  90.     For x = 1 To mapx
  91.             If array(x,y) = 0 Then
  92.                 DrawImage(tile0,x*25-25,y*25-25)
  93.             ElseIf array(x,y) = 1 Then
  94.                 DrawImage(tile1,x*25-25,y*25-25)
  95.             EndIf
  96.     Next
  97. Next
  98.  
  99. readinfo = 0
  100.  
  101. End Function
Advertisement
Add Comment
Please, Sign In to add comment