Livery Place 35 Livery Street Birmingham B3 2PB, UK. First published: May 2013 Producion Reference: 1170513 Published by Packt Publishing Ltd. However, Packt Publishing cannot guarantee the accuracy of this informaion. Packt Publishing has endeavored to provide trademark informaion about all of the companies and products menioned in this book by the appropriate use of capitals. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. However, the informaion contained in this book is sold without warranty, either express or implied. Every efort has been made in the preparaion of this book to ensure the accuracy of the informaion presented. No part of this book may be reproduced, stored in a retrieval system, or transmited in any form or by any means, without the prior writen permission of the publisher, except in the case of brief quotaions embedded in criical aricles or reviews. Let’s add a surface to our scene to prevent the actors from falling down.Learning Stencyl 3.x Game Development Beginner's Guide A fast-paced, hands-on guide for developing a feature-complete video game on almost any desktop computer, without wriing a single line of computer code lnnes Borkwood BIRMINGHAM - MUMBAI Learning Stencyl 3.x Game Development Beginner's Guide Copyright © 2013 Packt Publishing All rights reserved. Set vertical gravity as 85 and test the game. Next, we need to create a real world scenario, lets add some gravity.įrom the dashboard tab, click on scene, select MyScene and select the Physics tab. You can see that when Popeye collides with Bluto, Bluto moves out of the screen. Here is the image that I used:Īfter you have created the actor and set the above image as animation frame, switch to the MyScene tab and add Bluto into the scene as we added Popeye. Now, let’s create one more actor in our game and name it Bluto. Until now, we’ve created an actor for our game which moves backward and forward on left and right arrow key press. Also add the left key release event to stop motion on a key release as shown below: The only difference is negate which helps the actor move backward on the x-axis. You will notice that it’s the same as the right key press event. So, add another keyboard event as shown below: Next we need to set the left arrow key press to make the actor move backward. On pressing and releasing the right arrow key the actor should move forward. Now, test the game by clicking on the test game link. So add a new keyboard event and set the code block as shown below: Next we need to set the speed of motion to zero when the right key is released. Next, from the right side palette select the motion tab, select a second code block and drag it into the existing code block. Here is how the code block should look:Ĭlick on Control, which will show Choose Control, clicking on that will ask you to select a control. From the menu select Input and from Input select Keyboard. Clicking on Add Event will display a menu. On the left hand side, there is a button to add an event. Click on the actors’ object tab and select the Events tab. With the actor selected, press the right arrow key, it should move forward and on pressing left it should move backward. Next, we’ll add some behaviours to our actor. If all goes well, you should be able to see the game scene as shown below: Save your work and click on the Test Game button in the right upper corner of the screen. Click the Actor tab, select the Popeye image and place it on MyScene by clicking on the screen. Click it and you should see the Tiles and Actor tab. Towards the right side of the screen, you should see the Palette tab. Save your work and switch to the MyScene tab. Here is an image you can use to add the animation frame: An actor type has an animation, click to create one. Click on the create button to create a new Actor Type. In the left hand side menu, under Resources you can see Actor Types. Now, you can see two tabs, a dashboard tab and a MyScene tab. Name it MyScene and select a background color. You will now be prompted to create a scene for your game. Type a name for your game, for example HelloStencyl, leave the screen as default and click Create. You will be asked what kind of game to create, select Blank game. To create a game either click in the middle of the screen or on the green Create a New Game button in the top right hand side of the screen.
0 Comments
Leave a Reply. |