259,464

Views

Beginner

Level

35

Comments

Crash Course 2: Invaders - Part 2

by Hectate (Updated on 2015-02-01)


Part 2: Creating Actor Types

Step 3: Now that we have a blank game, it’s time to create our Actor Types. We’re going to start with our spaceship, which the player will control. Click the Actor Type button in the Dashboard menu on the left (under Resources, as shown).

Step 4: Next, click the large box in the workspace on the right (shown below) to create our first Actor Type.

Step 5: We will see the "Create New..." dialog appear (shown below). Name your Actor Type "Ship" as shown. Click the Create button.

Stencyl will create our new Actor Type and then open it for us.

Step 6: Our Actor Type does not yet have any images in it, we need to fix that so it can be seen by players. All images for an Actor Type are gathered in Animations, so we need to import images for these Animations. To do this, we need to first create at least one Animation to hold the images.

Since Stencyl opened the new Actor Type for editing in the Appearance tab, we are already where we need to be. Click the large box with the dotted line in the workspace on the right (shown below).

Stencyl will create a new Animation for us and open it in the workspace.

Step 7: We are now looking at the Animation Editor for the new Animation, which by default will be named "Animation 0".

An Animation typically represents a “state” that an Actor could be in, such as Walking, Running, Jumping, etc. As such, it is ideal for us to rename our Animation so that later we can easily identify what state it represents. We need to erase "Animation 0" from the Name field and type "Flying" into it.

Now that our new Animation has been named properly, let's give it some images. We will click on the "Click here to add a frame" box to open our image importer.

Step 8: The image importer dialog below will pop up for us. First we have to select an image to import; click the Choose Image button.

We should have saved and extracted the example assets earlier somewhere on our computer, so we should navigate to that folder. We want to open the "Ship_flying.png" image for this Animation (if you still need to download the assets, click here to download them).

Ship_flying.png selected

Step 9: Individual "frames" of an Animation image are commonly stored in a single larger image. In this case, Ship_flying.png contains four frames. Of course, Stencyl does not automatically know this, so we need to change some settings so the image is not imported as one single, large frame. Set the value in the “Columns” field to 4. This will split our image evenly into four frames separated by black lines, as shown below. Once ready, click Add and Stencyl will import the image as four frames of our Flying animation.

We are back in the Animation Editor and can see that our Flying animation is now showing an animation preview in the list, with the four individual frames in the workspace to the right.

Flying animation completed

Step 10: Now that we have our single Animation, we need to choose the correct Physics settings for our Ship Actor Type. Click the Physics tab, as shown below.

Step 11: The first page that will appear is the “General” page under Physics. Let's leave the "What kind of Actor Type?" option set to Normal, but set "Can Rotate? and "Affected by Gravity?" both to No.

Step 12: Now we need to set the Collision Group that our Actor Type is a member of. This will allow us to specify what our Ship can collide with and what it can’t. Click the Properties tab (shown below).

Step 13: Set the Group to "Players", as shown. If we want to create more Groups, there is an Edit Groups button on the right. You can read more about creating Groups here. Note the Players Group is built into Stencyl and will appear by default on when we click the dropdown, so we don't need to Edit Groups at this point.

Step 14: We want to save our Ship Actor Type (and the game) by clicking File and then Save Game. Note that there is a keyboard shortcut available for this, as well as the "Save Game" disk icon.

We have our Ship Actor Type set up now, so it's time to move on to determining how our Ship, and the other Actor Types we'll create, can collide with one another.

Click here to go to Part 3.

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!

35 Comments

pororo007
OMG.
This is awesome tutorial and I am so excited to finish the task.

But I face a problem when I want to import the ship graphic.
In asset folder the file size is 144X54

But, when I use it in stencyl, the image is 36 X13

here is the print screen from my computer.
http://postimg.org/image/s5t67vhfx/

I do follow all instructions but the ship is still small :(
I can not continue this learning as I stuck at STEP 9 =(

Friends, please help me.Help! help!


1 4 years, 7 months ago
princerain01
to those who doesn't know where to find the ship image, it is in the zip file that you need to download. the link is on the top of every part of this tutorial.
1 4 years, 8 months ago
shivoid10
how do you find the image for the ship?
1 4 years, 9 months ago
infinitum3d
@Powermax18

that's correct. your four images are all part of one big picture. the game engine will split it into four when the time is needed.

0 4 years, 9 months ago
lsitton000
i just made my own actor for this really :-P my brother thought it was a bat :-l
0 5 years, 1 week ago
PowerMax18
hi, i have a problem, in step 9 he said to set the value in the “Columns” field to 4, but my image doesn't split in 4 another images but there is just one picture with four lines inside it. what should i do?
1 5 years, 6 months ago
coshma
this is hard ish
0 5 years, 8 months ago
sabikDK
Please add the link, to the image, to the tutorial... just to make things easier.
0 5 years, 9 months ago
ProdigyFlash94
ATTENTION...there is a link in part 1 for the space ships image!!!

0 5 years, 11 months ago
Narque
There is no ship in my folders were do i find it or download it ?
0 5 years, 11 months ago

Sign In to Comment