This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-05-12 20:19:06

Superfly20
Scratcher
Registered: 2009-10-17
Posts: 3

I need some help with a tower defense game...

So I'm currently working on a tower defense game. It's very simple, and I already have most of it figured out and it runs pretty smoothly. However one of, if not the only, things I'm having trouble with is making the 'tower' lose health, or get damaged when an enemy hits it. Currently I have two variables, (one is "Enemies Destroyed", but that's irrelevant) and one is the Tower's Health. So what I have programmed for the enemy sprite is:

(btw in the actual script it's [color orange] TOUCHING [color gray])

[blocks]<when I receive[ start [/blocks]
[blocks]<show>[/blocks]
[blocks]<if><color[ orange ]is over[ gray [/blocks]
[blocks]<change{ tower health }by(-1 [/blocks]
[blocks]<end>[/blocks]

... and then it goes on with other things like movement, etc.

For what it's worth I have it programmed so that "When Flag Clicked", "Tower Health" is set to 30. Any help would be much appreciated. Thanks!

Offline

 

#2 2010-05-12 21:25:23

laser100
Scratcher
Registered: 2009-12-04
Posts: 100+

Re: I need some help with a tower defense game...

It has to repeat. If it doesn't, it will only follow that script once. Try putting another script that also starts with when I recieve [start] forever if touching color orange, change health by -1. Hope that helps. If you want, I can upload a test project!  smile

Offline

 

#3 2010-05-13 17:21:00

Superfly20
Scratcher
Registered: 2009-10-17
Posts: 3

Re: I need some help with a tower defense game...

Thanks!

Offline

 

#4 2010-05-14 02:27:24

masterhand7
Scratcher
Registered: 2009-10-05
Posts: 100+

Re: I need some help with a tower defense game...

Huh, in most TD games, the towers don't get damaged by enemies...


Click here to see the first iPhone virus!
http://www.danasoft.com/sig/MASTERHAND7PWNZ.jpg

Offline

 

#5 2010-05-14 10:51:14

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: I need some help with a tower defense game...

masterhand7 wrote:

Huh, in most TD games, the towers don't get damaged by enemies...

It was stated in this one that enemies could hit towers.


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

Board footer