169,595

Views

Beginner

Level

94

Comments

Crash Course 2: Invaders - Part 15

by Hectate (Updated on 2015-05-02)


Part 15: Final Touches

Step 102: Now that you’ve tested your game and everything works, it’s time to export it to your desktop as a SWF file. That way, you can open the file in any browser to play the game! Open the Publish menu, select Web, Flash.

http://static.stencyl.com/help/images/cc2_publish_to_flash.png

Step 103: Stencyl will create a SWF file and ask you to choose where to save the file and what to name it.

Congratulations! Now that you have your Crash Course game, you can take on the Challenges that follow, and modify the Crash Course game further, or you can start on your own game! The choice is yours.

Here are a few challenges you could take on if you want to take this project further. We won't provide you with any solutions, it's up to you to figure out how to add these features.

 

Challenges

Challenge 1: Find a way to make the Enemy Ships move back and forth on screen.

Challenge 2: Restrict how frequently the player can fire the cannon, either by setting a maximum for the number of bullets on screen or by limiting how quickly the player’s Ship can fire bullets.

Challenge 3: Make the Enemy Ships fire back at the Player.

 

Where do I go from here?

There's a whole lot more to Stencyl, and we encourage you to experiment on your own and read through the rest of Stencylpedia to find out how to import your own resources, create your own Behaviors, and enable Stencyl to help you create the games of your dreams.

 

Continue to Chapter 2

Disclaimer: Use comments to provide feedback and point out issues with the article (typo, wrong info, etc.). If you're seeking help for your game, please ask a question on the forums. Thanks!

94 Comments

isk8bits
for the second challenge try creating a bullet boolean that sets to false .1 seconds after the bullet key is pressed.
Then below the last do after put in a do after .5 seconds that sets bullet boolean to false.
finally put all your coding inside an if statement with Bullet oolean = false
should look like this

when action1 is pressed
if Bullet Boolean = false
create bullet at x: ....
push last created actor sharply....
do after .01 seconds
set Bullet Boolean to true
do after .5 seconds
set Bullet Boolean to false

You can change the times depending on how you want it to play out

0 12 years, 7 months ago
gpyles
I was able to get the enemy ships moving using the 'Back and Forth Horizontally' behavior so that was pretty easy!

To limit the number of bullets I created an attribute [Bullet Counter] on the player 'Ship' and then incremented by one when the bullet is created [Events - Actor Created] and decremented by one when the bullet is killed.

Then just added an [If Bullet Counter <= 1 ] around the Keyboard event block to limit the number of bullets on the screen to two.

It did take a little while to realize where I needed to add the attribute for the bullet counter. I had originally tried doing most of this on the Bullet actor but when I realized I needed to add the condition block to the code that accepted the keyboard action I moved everything to the ship actor.

Really liking Stencyl so far.


Now on to getting the enemy to fire...

1 12 years, 9 months ago
aaronisbrewing
So I got the ships to move back and forth, and down, but any movement causes the game to crash after about 10 shots or so... Ideas?
0 12 years, 9 months ago
Keleborn1
My Bullets
0 12 years, 9 months ago
rainvillain
Also, I like these challenges at the end.. but without showing us a solution for them (even as a link to another page) ends up being kinda frustrated as I can't figure out what I've done wrong. Gunna skip ahead instead of banging my head on some of these..
0 12 years, 10 months ago
rainvillain
Thanks for this entire tutorial. A couple parts could... really use some revision. A lot of very vague text and typos. Thankfully the comments section never failed me once. :)
0 12 years, 10 months ago
coolernow123
CHALLENGES ACCEPTED
1 12 years, 10 months ago
ArrAndBee
How fun! My 5 year old son and I did this together and had a great time. Now we are going to try to build the dragon shooting at letters game that my son thought up.
1 12 years, 10 months ago
dwayneo8
Hey, why is my ship is on the top left side, and disappear when i go left, and cant go to right? :(
0 12 years, 11 months ago
marcosjpin
This is a great tutorial, although there are some parts missing and some steps are really confusing.

However, after a while you get the idea and it becomes easier to spot what is wrong. Yes, of course, some of the comments were of great help when I got lost.

Now, is there a way of writing code in Stencyl? What is the language? ActionScript 3.0?

Thank you!

1 13 years, 1 day ago

Sign In to Comment