Guest User

Untitled

a guest
Jun 21st, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.75 KB | None | 0 0
  1. SuperStrict
  2.  
  3. Framework brl.glmax2d
  4. Import brl.font
  5. Import brl.freetypefont
  6. Import brl.basic
  7. Import brl.pngloader
  8. Import brl.random
  9.  
  10. Include "globals.bmx"
  11. Include "player.bmx"
  12. Include "mob.bmx"
  13. Include "blood.bmx"
  14. Include "bullet.bmx"
  15.  
  16. Type TEntity
  17.     Global list:TList = New TList
  18.     Field x:Float, y:Float, ang:Float, frame:Int
  19.     Field img:TImage, shadow:TImage, alpha:Float
  20.     Field life:Int
  21.     Field speed:Float
  22. End Type
  23.  
  24. AppTitle = "Excellent Meat v0.1"
  25. Graphics (g_width, g_height, 0)
  26. SetBlend (ALPHABLEND)
  27.  
  28. Global font:TImageFont = LoadImageFont ("fonts\xirod.ttf", 13)
  29. SetImageFont (font)
  30.    
  31. Global map_image:TImage = LoadImage ("gfx\tile_grass.png")
  32.        
  33. AutoMidHandle True
  34. Global img_blood1:TImage = LoadImage ("gfx\blood1.png")
  35. Global img_blood2:TImage = LoadImage ("gfx\blood2.png")
  36. Global img_blood3:TImage = LoadImage ("gfx\blood3.png")
  37. Global mob_image:TImage = LoadAnimImage ("gfx\monster.png", 40, 20, 0, 20)
  38. Global img_shadow:TImage = LoadImage ("gfx\player_shadow.png")
  39. Global img_bullet:TImage = LoadImage ("gfx\bullet.png")
  40. AutoMidHandle False
  41.        
  42. Global player_image:TImage = LoadAnimImage ("gfx\player.png", 68, 40, 0, 8)
  43. SetImageHandle player_image, ImageWidth (player_image) / 3, ImageHeight (player_image) / 2
  44. Global heart_image:TImage = LoadImage ("gfx\heart.png")
  45. Global mp5_image:TImage = LoadImage ("gfx\mp5.png")
  46. Global shotgun_image:TImage = LoadImage ("gfx\shotgun.png")
  47.        
  48. TPlayer.Create (player_image, img_shadow, g_width / 2, g_height / 2)
  49.  
  50. While Not KeyHit (KEY_ESCAPE)
  51.     SetColor 255, 255, 255
  52.     SetRotation 0.0
  53.     SetAlpha 1.0
  54.     SetScale 1.0, 1.0
  55.     For Local x:Int = 0 Until map_width
  56.         For Local y:Int = 0 Until map_height
  57.             If map_image Then DrawImage map_image, (x * ImageWidth (map_image)) - CameraX, (y * ImageHeight (map_image)) - CameraY
  58.         Next
  59.     Next
  60.        
  61.     For Local b:TBlood = EachIn TBlood.List
  62.         b.Update
  63.         b.Draw
  64.     Next
  65.  
  66.     For Local m:TMob = EachIn TMob.List
  67.         m.Update
  68.         m.Draw
  69.     Next
  70.  
  71.     For Local b:TBullet = EachIn TBullet.List
  72.         b.Update
  73.         b.Draw
  74.     Next
  75.    
  76.     For Local p:TPlayer = EachIn TPlayer.List
  77.         p.Update
  78.         p.Draw
  79.     Next
  80.  
  81.     DrawText "Score: " + player_score, 0, 0
  82.  
  83.     If time_create < MilliSecs () Then
  84.         time_create = MilliSecs () + (1500 - time_subtract_spawn)
  85.         Local pos:Int = Rand (1, 4)
  86.         Select pos
  87.             Case 1 ;TMob.Create (mob_image, img_shadow, player.x - 50, Rand (g_height))
  88.             Case 2 ;TMob.Create (mob_image, img_shadow, g_width + 50, Rand (g_height))
  89.             Case 3 ;TMob.Create (mob_image, img_shadow, Rand (g_width), -50)
  90.             Case 4 ;TMob.Create (mob_image, img_shadow, Rand (g_width), g_height + 50)
  91.         End Select
  92.     End If
  93.        
  94.     Flip
  95.     Cls ()
  96.     GCCollect ()
  97. Wend
  98.  
  99.  
  100. Function GetAngle:Double (x0:Double, y0:Double, x1:Double, y1:Double)
  101.     Return ATan2 (y1 - y0, x1 - x0)
  102. End Function
Add Comment
Please, Sign In to add comment