Stencyl 3.4.0 is now out. Get it now!

WIP – A Tower Defense Tutorial for Stencyl 2.0

Xietao

  • Posts: 725
Just for the fun of it, I've started writing a tutorial for Stencyl 2.0 involving Tower Defense elements. It is meant as a follow-up on the new crash-courses in the new Stencylpedia.
Stencyl 2.0 or later ;)
Free Time:
Monday, Wednesday, Friday: 13h
Tuesday, Thursday, Saturday, Sunday: 7h
Loving Linux...

CrimsonThunder

  • Posts: 96
You taking a lot of time to made the Part 7.
He does it in his spare time and has a life to live, don't be impatient and rude.

publysher

  • Posts: 41
Hi all,

I've just posted Part 7 - Creating Towers.

I've also updated all the previous posts with the wonderful feedback of @Daedalon.

A few clarifications on Daedalon's suggestions:

- I appreciate that not everyone would like to use StencylForge. However, I believe that StencylForge is actually one of the most powerful parts of the Stencyl experience. Therefore, I will no longer post Resources online as it's too much of a hassle for me. You can still use the tutorial, and I will keep posting screenshots of all the 'difficult' stuff.

- From now on, every behavior will be accompanied by a screenshot of all the attributes used. I will try to add them to previous posts as well.


Another point: this tutorial is meant to build on itself; in other words, I'm slowly picking up speed and leaving out details I've already covered. If anyone feels that I'm going too fast, please tell me in this forum thread.

And finally: thank you all for your enthousiasm and helping each other with the difficult parts. It's a big incentive for me to continue.

Xietao

  • Posts: 725
Good Work!
Have got more parts (Upgrading, Selling...)?
Free Time:
Monday, Wednesday, Friday: 13h
Tuesday, Thursday, Saturday, Sunday: 7h
Loving Linux...

CrimsonThunder

  • Posts: 96
Hi all,

I've just posted Part 7 - Creating Towers.

I've also updated all the previous posts with the wonderful feedback of @Daedalon.

A few clarifications on Daedalon's suggestions:

- I appreciate that not everyone would like to use StencylForge. However, I believe that StencylForge is actually one of the most powerful parts of the Stencyl experience. Therefore, I will no longer post Resources online as it's too much of a hassle for me. You can still use the tutorial, and I will keep posting screenshots of all the 'difficult' stuff.

- From now on, every behavior will be accompanied by a screenshot of all the attributes used. I will try to add them to previous posts as well.


Another point: this tutorial is meant to build on itself; in other words, I'm slowly picking up speed and leaving out details I've already covered. If anyone feels that I'm going too fast, please tell me in this forum thread.

And finally: thank you all for your enthousiasm and helping each other with the difficult parts. It's a big incentive for me to continue.
Tut 7 looks great and the speed you're going at is fine in my opinion. :)

CrimsonThunder

  • Posts: 96
Nearing the end of Tutorial 6 I get this error, not sure what it is, however it only happens when I have path finding on there... If path finding isn't on (i delete the numbers) the game doesn't have an error but obviously nothing happens. I've looked over everything a few times and I'm pretty sure all my code is right... Any idea?

Code: [Select]
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at scripts::Design_16_16_SpawnEnemies/Activate_Enemy()[C:\Users\Stevo\AppData\Roaming\Stencyl\stencylworks\preview\scripts\Design_16_16_SpawnEnemies.as:120]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at stencyl.api.engine.behavior::BehaviorManager/call2()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/root/stencyl/api/engine/behavior/BehaviorManager.as:405]
at stencyl.api.engine.actor::Actor/say()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/root/stencyl/api/engine/actor/Actor.as:2503]
at scripts::Design_16_16_SpawnEnemies/Spawn_Enemy_Type()[C:\Users\Stevo\AppData\Roaming\Stencyl\stencylworks\preview\scripts\Design_16_16_SpawnEnemies.as:110]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at stencyl.api.engine.behavior::BehaviorManager/call2()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/root/stencyl/api/engine/behavior/BehaviorManager.as:405]
at stencyl.api.engine.actor::Actor/say()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/root/stencyl/api/engine/actor/Actor.as:2503]
at Function/<anonymous>()[C:\Users\Stevo\AppData\Roaming\Stencyl\stencylworks\preview\scripts\Design_16_16_SpawnEnemies.as:75]
at stencyl.api.engine::TimedTask/update()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/root/stencyl/api/engine/TimedTask.as:46]
at stencyl.api.engine::GameState/innerUpdate()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/root/stencyl/api/engine/GameState.as:1661]
at stencyl.api.engine::GameState/postUpdate()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/root/stencyl/api/engine/GameState.as:1511]
at stencyl.api.engine::GameState/update()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/root/stencyl/api/engine/GameState.as:1493]
at org.flixel::FlxGame/update()[/home/stencyl/stencyl.net/jenkins/jobs/StencylWorks-Dist/workspace/plaf/flash/flixel/org/flixel/FlxGame.as:407]

Xietao

  • Posts: 725
I had got this error. Do this:
 Download publysher game and export the behavior Spawn Enemies
 Import it using the Import.. Feature
 Voila!
Free Time:
Monday, Wednesday, Friday: 13h
Tuesday, Thursday, Saturday, Sunday: 7h
Loving Linux...

CrimsonThunder

  • Posts: 96
I had got this error. Do this:
 Download publysher game and export the behavior Spawn Enemies
 Import it using the Import.. Feature
 Voila!
Thanks! I wonder why it didn't work?

And now when I play my game the characters come out very slowly, then stop and they don't animate either...

publysher

  • Posts: 41
I've just published Part 8 - Satisfaction and Scoring . Happy tower defending!

publysher

  • Posts: 41
I had got this error. Do this:
 Download publysher game and export the behavior Spawn Enemies
 Import it using the Import.. Feature
 Voila!
Thanks! I wonder why it didn't work?

And now when I play my game the characters come out very slowly, then stop and they don't animate either...

Hi CrimsonThunder,

It's a very weird bug and I haven't noticed it myself – did this occur with self-made behaviors or with the game I put on StencylForge?

As for your new problem: if you can upload the game to StencylForge I will have a look at it.

- publysher

CrimsonThunder

  • Posts: 96
I had got this error. Do this:
 Download publysher game and export the behavior Spawn Enemies
 Import it using the Import.. Feature
 Voila!
Thanks! I wonder why it didn't work?

And now when I play my game the characters come out very slowly, then stop and they don't animate either...

Hi CrimsonThunder,

It's a very weird bug and I haven't noticed it myself – did this occur with self-made behaviors or with the game I put on StencylForge?

As for your new problem: if you can upload the game to StencylForge I will have a look at it.

- publysher
No it worked perfectly fine with the one on StencylForge and I double checked so many times and I'm pretty sure I have it right, and it seems Xietao has the same problem.

I'll upload 2 versions for you, the first (Tower Defense Game) is the one with my own copy of the Spawn Enemies (with all the errors). The second (Tower Defense Game2) has your copy of Spawn Enemies, if you want to see how the enemies stay static move the Spawning Pool in a little bit.

Thanks Publysher.

publysher

  • Posts: 41
OK, I found the first problem. Your "make [self] spawn actor of type [type]" states that "Type" is an Actor Type – however, we are giving it Text; the result is that Stencyl tries to convert the text "A" to an actor type, but there is no such actor type.

I have updated part 6 – it now shows the "Create Custom Block" dialogs for every custom block.

- publysher

publysher

  • Posts: 41
And I found the second problem as well – in your Tower Defense2 the customization of your enemy spawners is off. The first enemy spawner has only one Path coordinate; the second enemy spawner has no Path coordinates at all.

- publysher

CrimsonThunder

  • Posts: 96
OK, I found the first problem. Your "make [self] spawn actor of type [type]" states that "Type" is an Actor Type – however, we are giving it Text; the result is that Stencyl tries to convert the text "A" to an actor type, but there is no such actor type.

I have updated part 6 – it now shows the "Create Custom Block" dialogs for every custom block.

- publysher
Awesome. Thanks. :) Is there any way to edit a custom block or do I have to delete and start again?

CrimsonThunder

  • Posts: 96
And I found the second problem as well – in your Tower Defense2 the customization of your enemy spawners is off. The first enemy spawner has only one Path coordinate; the second enemy spawner has no Path coordinates at all.

- publysher
Yeah I didn't bother with the second one and the first one even after adding more they still stop there. I don't think I understand how it works?

As for that block, I deleted the old one and created a new one, I now don't get the error but no enemies get spawned at all.