PDA

Click to See Complete Forum and Search --> : How do I make my enemy ships move?


Ploy-X
Oct 2nd, 2000, 04:41 PM
I need some help with this. I am making a shoot'em up game you know where the guy you control is at the bottom shooting guys from the top, well I was woundering how to make the enemies come down and when I shoot them they die if anyone could help me with the guys coming down I would like it very much.

/\/\isanThr0p
Oct 2nd, 2000, 05:34 PM
Sounds easy, but to help me I need to know how you draw the enemys?
U use bitblt or similar? Just set vars for the coordinates na dlet them move in a loop!

SteveCRM
Oct 2nd, 2000, 05:34 PM
like this?

imgEnemy.top = imgEnemy.top + 40
'change the interval to change the speed

/\/\isanThr0p
Oct 2nd, 2000, 07:02 PM
Yes? But it sounds like you are using picture boxes to display the enemys! (of course it coul also be a type, or a rect(where you'd need to change the bottom =bottom+40 too))

Don't use pictureboxes and moving them around.

DDraw rulez, but Bitblt does a good job in most cases, too.

DarkMoose
Oct 2nd, 2000, 08:48 PM
Picture boxes are EVIL!!....uh.. hi. I made a shooter game befoure. not too difficult and good for beginnerz. Artificial Intelligence codez are merely storing info in variables and then using BitBlt to put them on the screen. You could create a new type to store X and Y for the enemy position then make a variable array for each of the enemy ships. I did something like this:

Type Enemy
X As Integer
Y As Integer
End Type

Dim EnemyShipArray(9) As Enemy

Private Sub YourGameLoop
For MoveShips = 0 To 9
EnemyShipArray(MoveShips).X = EnemyShipArray(9).X - 5
EnemyShipArray(MoveShips).Y = EnemyShipArray(9).Y - 3
Next MoveShips
End Sub

And then of course you can use another For loop to paint them all.

BTW, how do you peoplez post segments of code on here and make it look all neat n stuff!?

Fox
Oct 3rd, 2000, 12:11 AM
Jep DarkMoose,

Don't use Timers, Images, and not more than 1 picturebox per game. (PicBoxes are nice if you need a frame control.. and the Frame sux ;))