PRo-Beaniie
Well-known member
- Joined
- Mar 17, 2011
- Messages
- 55
- Programming Experience
- 3-5
Hey Guys,
As you may have read in my other posts i am creating a game in VB.NET for my First Diploma college course ... Im just putting the finishing touches on the game now. However Thought to myslef why not make te game that little bit more interesting... i have a genral idea of what i want to happen but have no knowledge of Random events...
Basically what i have is three enemys (helicopters) going across the screen to the Right. when fired appon they recycle back to the starting position. THey do the same if they reach the end of the form also, What i am hoping for is to learn some code that could make the enemy projectile fall from the Enemys Randomly.
Like i said i have no knowledge of random events and i am hoping you guys could enlighten me. I think i have the code for the Enemyprojectile to fall from the Enemy as shown below...
If you could help it would be much appreciated.
Thanks,
As you may have read in my other posts i am creating a game in VB.NET for my First Diploma college course ... Im just putting the finishing touches on the game now. However Thought to myslef why not make te game that little bit more interesting... i have a genral idea of what i want to happen but have no knowledge of Random events...
Basically what i have is three enemys (helicopters) going across the screen to the Right. when fired appon they recycle back to the starting position. THey do the same if they reach the end of the form also, What i am hoping for is to learn some code that could make the enemy projectile fall from the Enemys Randomly.
Like i said i have no knowledge of random events and i am hoping you guys could enlighten me. I think i have the code for the Enemyprojectile to fall from the Enemy as shown below...
VB.NET:
Private Sub DropMissilePosition()
For Me.x = 1 To NumOfEnemy
If Enemy(x).Left = Me.ClientRectangle.Left + 250 And EnemyMissile.Visible = False Then
EnemyMissile.Top = Enemy(x).Top
EnemyMissile.Left = Enemy(x).Left + (Enemy(x).Width / 2) - (EnemyMissile.Width / 2)
EnemyMissile.Visible = True And (EnemyMissile.Top >= Enemy(x).Height + Enemy(x).Width) And Me.ClientRectangle.Width
End If
Next
End Sub
Private Sub DropMissile()
'EnemyMissile Timer Variables ...
If EnemyMissile.Visible = True Then
EnemyMissile.Top += enemymissilespeed
End If
If EnemyMissile.Top + EnemyMissile.Height < Me.ClientRectangle.Top Then
EnemyMissile.Visible = False
End If
End Sub
If you could help it would be much appreciated.
Thanks,