Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
  2.  
  3. If e.KeyValue = Keys.Shift Then
  4. WSpeed = 15
  5. End If
  6. If e.KeyValue = Keys.D Then
  7. WRight = True
  8. WLeft = False
  9. Wizard.Image = Image.FromFile("C:\Users\kungf_000\Desktop\New my games\Wizard\wizard-right.png")
  10. End If
  11. If e.KeyValue = Keys.A Then
  12. WLeft = True
  13. WRight = False
  14. Wizard.Image = Image.FromFile("C:\Users\kungf_000\Desktop\New my games\Wizard\wizard-left.png")
  15. End If
  16. If e.KeyValue = Keys.W Then
  17. WForward = True
  18. Wizard.Image = Image.FromFile("C:\Users\kungf_000\Desktop\New my games\Wizard\wizard-back.png")
  19. End If
  20. If e.KeyValue = Keys.S Then
  21. WBackwards = True
  22. Wizard.Image = Image.FromFile("C:\Users\kungf_000\Desktop\New my games\Wizard\wizard-front.png")
  23. End If
  24. If e.KeyValue = Keys.Up And WizardShot1.Visible = False Then
  25. WizardShot1.Top = Wizard.Top
  26. WizardShot1.Left = Wizard.Left + (Wizard.Width / 2) - (WizardShot1.Width / 2)
  27. WizardShot1.Visible = True
  28. WizardShot1.Image = Image.FromFile("C:\Users\kungf_000\Desktop\New my games\Shots\WizardShot\shot-up.png")
  29. End If
  30. If e.KeyValue = Keys.Down And WizardShot2.Visible = False Then
  31. WizardShot2.Top = Wizard.Bottom
  32. WizardShot2.Left = Wizard.Left + (Wizard.Width / 2) - (WizardShot2.Width / 2)
  33. WizardShot2.Visible = True
  34. WizardShot2.Image = Image.FromFile("C:\Users\kungf_000\Desktop\New my games\Shots\WizardShot\shot-down.png")
  35. End If
  36. If e.KeyValue = Keys.Left And WizardShot3.Visible = False Then
  37. WizardShot3.Top = Wizard.Top
  38. WizardShot3.Left = Wizard.Left + (Wizard.Height / 2) - (WizardShot3.Height / 2)
  39. WizardShot3.Visible = True
  40. WizardShot3.Image = Image.FromFile("C:\Users\kungf_000\Desktop\New my games\Shots\WizardShot\shot-left.png")
  41. End If
  42. If e.KeyValue = Keys.Right And WizardShot4.Visible = False Then
  43. WizardShot4.Top = Wizard.Top
  44. WizardShot4.Left = Wizard.Left + (Wizard.Height / 2) - (WizardShot4.Height / 2)
  45. WizardShot4.Visible = True
  46. WizardShot4.Image = Image.FromFile("C:\Users\kungf_000\Desktop\New my games\Shots\WizardShot\shot-right.png")
  47. End If
  48. End Sub
  49.  
  50.  
  51. Private Sub moveEnemy()
  52. Dim x As Integer
  53. Dim speed As Integer = 1
  54. Dim pos As Point
  55.  
  56. Dim CreatureCollision As Boolean
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63. If Wizard.Location.X < Golem.Location.X And EnemyCollision(Golem, CreatureCollision) = False Then
  64. Golem.Image = Image.FromFile("C:\Users\kungf_000\Desktop\New my games\Golem\golem-left.png")
  65. Golem.Left -= speed
  66. ElseIf EnemyCollision(Golem, CreatureCollision) = True Then
  67. Golem.Left -= 5
  68. CreatureCollision = False
  69. End If
  70. If Wizard.Location.X > Golem.Location.X And EnemyCollision(Golem, CreatureCollision) = False Then
  71. Golem.Image = Image.FromFile("C:\Users\kungf_000\Desktop\New my games\Golem\golem-right.png")
  72. Golem.Left += speed
  73. ElseIf EnemyCollision(Golem, CreatureCollision) = True Then
  74. Golem.Left += 5
  75. CreatureCollision = False
  76. End If
  77. If Wizard.Location.Y > Golem.Location.Y And EnemyCollision(Golem, CreatureCollision) = False Then
  78. Golem.Image = Image.FromFile("C:\Users\kungf_000\Desktop\New my games\Golem\golem-front.png")
  79. Golem.Top += speed
  80. ElseIf EnemyCollision(Golem, CreatureCollision) = True Then
  81. Golem.Top += 5
  82. CreatureCollision = False
  83. End If
  84. If Wizard.Location.Y < Golem.Location.Y And EnemyCollision(Golem, CreatureCollision) = False Then
  85. Golem.Image = Image.FromFile("C:\Users\kungf_000\Desktop\New my games\Golem\golem-back.png")
  86. Golem.Top -= speed
  87. ElseIf EnemyCollision(Golem, CreatureCollision) = True Then
  88. Golem.Top -= 5
  89. CreatureCollision = False
  90. End If
  91.  
  92.  
  93. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement