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

#1 2012-09-06 10:37:35

Jodymoses
Scratcher
Registered: 2012-05-03
Posts: 100+

Tower Defence

How do you make a tower defence game that auto shoots at enemies but not as difficultly programed as the great scratch game forum defence


http://i46.tinypic.com/2hxwx9s.png
I Have Huge Ideas, But Only If You Listen And Talk To Me...

Offline

 

#2 2012-09-06 13:53:57

Jodymoses
Scratcher
Registered: 2012-05-03
Posts: 100+

Re: Tower Defence

Bump


http://i46.tinypic.com/2hxwx9s.png
I Have Huge Ideas, But Only If You Listen And Talk To Me...

Offline

 

#3 2012-09-06 15:24:20

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Tower Defence

A very simple one would have a sprite for each tower, and a sprite for each enemy. The tower would pick a random enemy (doable with a list and the "point towards" command), and then broadcast something to a bullet sprite, that would then move until it reaches an enemy or goes outside its range, then go back to the tower and hide. The enemy would have a preprogrammed path and if it touches a bullet, it gets damaged. I have a simple TD uploaded on this account.


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#4 2012-09-07 09:11:04

Jodymoses
Scratcher
Registered: 2012-05-03
Posts: 100+

Re: Tower Defence

???


http://i46.tinypic.com/2hxwx9s.png
I Have Huge Ideas, But Only If You Listen And Talk To Me...

Offline

 

#5 2012-09-07 19:19:32

owetre18
Scratcher
Registered: 2009-07-01
Posts: 1000+

Re: Tower Defence

Jodymoses wrote:

???

He just explained it. Here, let me make it simpler.

1) Make a sprite for each tower, and a sprite for each enemy.
2) Use the block that's called point to, and make a list of all the enemy names
3) Make a broadcast to shoot
4) Make the bullet sprite move towards the enemy, then disappear when out of the range of the tower or on the edge of the screen
5) Enemy gets damaged when touching bullet
6) Enemy health is a variable
7) zammer990 has a simple Tower Defense game on his account.

Offline

 

#6 2012-09-08 04:02:41

Jodymoses
Scratcher
Registered: 2012-05-03
Posts: 100+

Re: Tower Defence

Ok, i understood that whole scenario from the beginning, all that i don't understand is the whole scripting thing and where the boundary is eg. Do you use  a circe to show the boundary? And something about a list


http://i46.tinypic.com/2hxwx9s.png
I Have Huge Ideas, But Only If You Listen And Talk To Me...

Offline

 

#7 2012-09-10 14:42:48

EEKings
New Scratcher
Registered: 2012-08-18
Posts: 8

Re: Tower Defence

Jodymoses wrote:

???

What did you mean all you say is "???" Why?

Offline

 

#8 2012-09-11 08:17:40

Jodymoses
Scratcher
Registered: 2012-05-03
Posts: 100+

Re: Tower Defence

It means

 
when gf clicked
say (i don't understand what to do except for the sprites)
end


http://i46.tinypic.com/2hxwx9s.png
I Have Huge Ideas, But Only If You Listen And Talk To Me...

Offline

 

#9 2012-09-11 09:35:03

ProgrammingPro01
Scratcher
Registered: 2011-07-30
Posts: 1000+

Re: Tower Defence

Advanced use of variables and broadcasting is the easiest idea I have, sorry.  tongue
But the whole above posts do make sense, if the above posts confuse you too much, try something simpler?
I'm being of no help, sorry.  neutral


Bye 1.4!
http://www.reactiongifs.com/wp-content/uploads/2013/04/sobbing.gifhttp://25.media.tumblr.com/tumblr_mbfh6bIamQ1qky11ho1_500.png

Offline

 

#10 2012-09-11 10:43:10

Sonic_The_Werehog
Scratcher
Registered: 2012-08-04
Posts: 12

Re: Tower Defence

Jodymoses wrote:

It means

 
when gf clicked
say (i don't understand what to do except for the sprites)
end

Please don't blockspam.

Offline

 

#11 2012-09-11 11:47:55

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Tower Defence

Pick a single element, and think about how to script it, then build a prototype script, if it works, then pick another thing that needs doing. One script you'd need is one to find the distance for all the enemies (harder when you're doing a single sprite for more than 1 enemy, but that's more advanced scripting), adds them to a list, then picks the closest/a random one, and points the turret towards it.


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#12 2012-09-11 12:34:15

Jodymoses
Scratcher
Registered: 2012-05-03
Posts: 100+

Re: Tower Defence

O k i'll try it


http://i46.tinypic.com/2hxwx9s.png
I Have Huge Ideas, But Only If You Listen And Talk To Me...

Offline

 

Board footer