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

#1 2012-12-15 12:24:18

Bob2Bob2Bob2
New Scratcher
Registered: 2012-12-15
Posts: 2

Tower Defense trouble!

I have done

 
when I recive wave etr
forever
if<(distance to enimie)> =50
repeat until <Distance to enimie=>>50>
switch costumes to costume 2

should'nt this work!!!???

help please  smile
sad
:]

Offline

 

#2 2012-12-15 12:30:46

Bob2Bob2Bob2
New Scratcher
Registered: 2012-12-15
Posts: 2

Re: Tower Defense trouble!

Oh, thats supposed to be a proper bock on top
ps: its pretty buggy troll :0

Offline

 

#3 2012-12-15 13:10:59

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Tower Defense trouble!

Bob2Bob2Bob2 wrote:

I have done

 
when I receive [wave etr v]
forever
 if<(distance to [enimie v]) < (50)>
  repeat until <(distance to [enimie v]) > (50)>
   switch to costume [costume 2 v]
  end
 end
should'nt this work!!!???

help please  smile
sad
:]

Fixed.

Anyway, no, that won't work, though you have the basic idea right. As you have it, your script won't make your tower turn towards the enemy and it won't reset it's costume when the enemy is out of range. So, try adding a few blocks so that it looks like this:

 
when I receive [wave etr v]
forever
 if<(distance to [enimie v]) < (50)>
  repeat until <(distance to [enimie v]) > (50)>
   switch to costume [costume 2 v]
   point towards [enimie v]
  end
 end
 switch to costume [costume 1 v]

Now, once you've done that, you'll need to add in a way to damage your enemy; I'll leave that up to you because you know your project better than I do.

Anyway, I hope that this helps! Also, hello Bob2Bob2Bob2 and welcome to Scratch! I wish you a great time here!

Last edited by ErnieParke (2012-12-15 13:12:12)


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer