L
Lee Hartsell
Guest
Hello everyone!
First time posting. I was hoping for some help or advice on how to tackle something specific in my game.
I'm designing a simple tower defense game for my design class.
I'll briefly run you through the concept for some context:
What am I trying to do here is:
Currently, my code doesn't quite do that. Instead, it draws one after the first astronaut, and then again after every fifth astronaut. So at 1, then 6, then at 11, and so on.
Here's my code as is (note: player health atm is 15):
I've wasted enough time with this feature here, but it's one I'd really like to have.
Since this is a school project, I am just looking for tips, or suggestions for a more effective way to do this.
I'd appreciate advice or pseudo-code rather than just straight code!
Thanks a lot!
First time posting. I was hoping for some help or advice on how to tackle something specific in my game.
I'm designing a simple tower defense game for my design class.
I'll briefly run you through the concept for some context:
Human explorers have invaded your planet! To ensure your race's survival, you have decided to waylay the humans as they attempt to flee your planet. Prevent as many astronauts from reaching their ship as you can!
Since I'll be counting astronauts, player health starts at 0 and ends at a number based on the level.
What am I trying to do here is:
- count how many astronauts have reached the ship
- when that number is divisible by five -
- - draw an astronaut sprite at the top left hand corner
- continue this until level ends
Currently, my code doesn't quite do that. Instead, it draws one after the first astronaut, and then again after every fifth astronaut. So at 1, then 6, then at 11, and so on.
Here's my code as is (note: player health atm is 15):
Code:
var astros = (obj_Controller.playerHp/5);
for (var i = 0; i < astros; i++)
{
draw_sprite(spr_playerHp, 0, (i * 32) + 32, 32)
if ((obj_Controller.playerHp mod 5) == 0)
{
draw_sprite(spr_playerHp, 0, (i * 32) + 32, 32)
}
}
I've wasted enough time with this feature here, but it's one I'd really like to have.
Since this is a school project, I am just looking for tips, or suggestions for a more effective way to do this.
I'd appreciate advice or pseudo-code rather than just straight code!
Thanks a lot!