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

#1 2012-05-03 16:12:36

momosproductions
Scratcher
Registered: 2011-05-29
Posts: 36

Any advice for scripting a tower defence game!?

I am trying to make a tower defence game like no other the MAY be called kirby splash, instead of some weird monster guy defending the tower it will be kirby or another little cute character, he will be defending something like a cookie and instead of guns he will have water guns! I think it will be a great and successful game if i pull it off! But i will need you help! So if you have any scripting advice for a tower defence game please help!

Last edited by momosproductions (2012-05-03 16:12:53)


Momosproductions, some EPIC scratcher..  smile

Offline

 

#2 2012-05-03 17:30:00

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

Re: Any advice for scripting a tower defence game!?

Have a set of sprites for each position, each one a duplicate of eachother, make each one contain a script that says:

when tower1 clicked// this needs a limiter
if (money) > (cost)
change [towerlevel v] by [1] //this would be for future use
change (costume#) by [1]
end

when gf clicked
forever
if (distancetoenemy1) < [30] //this would need to be duplicated for every enemy
if (towerlevel) = [1]
broadcast [shooting v]
wait (reloadtime) secs
point towards [enemy1 v]
end
end

when I receive [shooting v] //bullet scripts, again needs loads duplication
show
go to x:([xposition v] of (tower1)) y:([yposition] of (tower1))
point in direction ((direction) of (tower1))

when gf clicked
hide
forever
if touching [enemy1 v]
if (towerlevel) = [1]
broadcast [enemy1dam1 v]

when gf clicked //enemy scripts
forever
if (level) = [1]
set [speed v] to [3]
repeat [x] //this needs tweaking depending on the level shape
move (speed) steps
rotate [x] degrees
end

when I receive [enemy1dam1 v] //MOAR DUPING!
change [health v] by [-1]

I just gave you the outline scripts, this would use LOADS of sprites, ie.10+ enemies, towers, tower bullets

this is a framework, if you can figure out how it works you should be fine, if not, make pong...

I HAVE NO IDEA IF THIS WORKS!!! I just came up with it on the spot


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

Offline

 

#3 2012-05-03 17:53:40

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: Any advice for scripting a tower defence game!?

zammer990 wrote:

Have a set of sprites for each position, each one a duplicate of eachother, make each one contain a script that says:

when tower1 clicked // this needs a limiter
if <(money) > (cost)>
change [towerlevel v] by [1] //this would be for future use
change (costume#) by [1]
end

when gf clicked
forever
if <(distance to [enemy1 v]) < [30]> //this would need to be duplicated for every enemy
if <(towerlevel) = [1]>
broadcast [shooting v]
wait (reloadtime) secs
point towards [enemy1 v]
end
end

when I receive [shooting v] //bullet scripts, again needs loads duplication
show
go to x:([xposition v] of [tower1 v]) y:([yposition v] of [tower1 v])
point in direction ([direction v] of [tower1 v])

when gf clicked
hide
forever
if <touching [enemy1 v]?>
if <(towerlevel) = [1]>
broadcast [enemy1dam1 v]

when gf clicked //enemy scripts
forever
if <(level) = [1]>
set [speed v] to [3]
repeat [x] //this needs tweaking depending on the level shape
move (speed) steps
turn cw [x] degrees
end

when I receive [enemy1dam1 v] //MOAR DUPING!
change [health v] by [-1]

I just gave you the outline scripts, this would use LOADS of sprites, ie.10+ enemies, towers, tower bullets

this is a framework, if you can figure out how it works you should be fine, if not, make pong...

I HAVE NO IDEA IF THIS WORKS!!! I just came up with it on the spot

Offline

 

#4 2012-05-04 02:11:41

momosproductions
Scratcher
Registered: 2011-05-29
Posts: 36

Re: Any advice for scripting a tower defence game!?

Ok thanks, when it comes i will try it out soon!  smile


Momosproductions, some EPIC scratcher..  smile

Offline

 

Board footer