petrosraka.blogg.se

Stencyl forum
Stencyl forum









stencyl forum
  1. #STENCYL FORUM HOW TO#
  2. #STENCYL FORUM CODE#
  3. #STENCYL FORUM FREE#

The scene is about ten times bigger in height than the standard 15 tile layout. The player sprite starts at the bottom of the scene, and moves to the top of the screen. I am making a game that scrolls vertically. My instance was a little more complicated than this. Then there are others who may need to set boundaries for left, top, and right, but leave the bottom alone, for pitfall style games where you want your player to be able to fall in to traps or large holes. This works for side to side shooters like Galaga, where the player is fixed into a single Y position and can only move on the X axis. Some may need to stop the player actor from leaving just the sides of the screen. We all need this feature for different reasons, at different times. Until next time, Cheers!Ī common question that I run in to all of the time on different Stencyl related forums and blogs is, "How do I keep my character from leaving the screen?".

#STENCYL FORUM FREE#

And, as always, if you have any questions feel free to drop a comment here, and I assure you, I will respond as promptly as possible.

#STENCYL FORUM CODE#

Play around with your code blocks a little and see what you can come up with. There are a lot you can do with screen boundaries to enhance the flow of game play over just about any and every genre of game that there is. Simply set the boundary of the scene to move you to the corresponding X or Y position on the next scene. Or, for instance, say you want to have one scene run into another. In general, if you want to be able to leave the screen on one side, just don't set a boundary for that side. In just about any game type you will find reasons for some level of customization of the screens boundaries at some point or another. Now, make your block of code fade out of the scene and return to a start screen, or even better, a "Try Again?" screen. Also add a sound effect to it that you would use for any other kind of death event for your player actor. When your character falls, make your block change to a special animation just for falling deaths. Basically, in a nut shell, all this does is, if you player actor falls into a hole, it deletes him from memory. One thing to note about the above block, is that it is very basic, and not aesthetically please. In just about 100% of classic platform games, if you fall off the platforms into an empty space in the scene, you die. Now, if you use a camera actor like in my last tutorial, you will see that the screen is exactly the same but there is added space above the cameras view point that you can use to set up secret areas, etc. Quick tip: Optionally, if you wanted to create a scenario where you could move above the screen, like in the instance of Super Mario with his trusty Flying P, you could create the scene a tile or two larger on the Y axis, and then set your boundaries at the actual scene height. This block of code prevents us from moving above the scene boundaries at the top of the screen. You may need to adjust your numbers slightly to get the right performance for your game. As this is just an example script I am using a standard scene size of 20 x 15 at 32 pixels per tile. Note: The exact numbers in this block of code may not be right for you. To accomplish this, we would first set blocks of code in place that prevent our player actor from moving beyond zero pixels to the left, and greater than our highest pixel to the right on the X axis (horizontal). Most likely, you also want your actor to not shoot in to space, but you do want them to be able to fall into holes and traps.

stencyl forum

In a typical platform game, you want to be able to move left or right freely, except in the case of the far left and right borders of the scene.

#STENCYL FORUM HOW TO#

I will also show you how to customize this even further to add Mario style effects for fall through's, etc. In part two of how to keep your actors from going off screen, I will teach you how to customize the blocks I gave you in the first tutorial to fit other types of game play, such as a platformer where you want your character to be able to fall through the bottom. When you break it down, there are a ton of reasons why keeping your actors on screen is useful, but what is even more useful is being able to customize that feature to fit any type of game play or scenario. Now, as useful as that is, it doesn't really cover the whole topic of how to keep your actors from going off screen. In the first tutorial, I showed you how I kept my player actor locked in to the camera on a vertical auto-scrolling scene.











Stencyl forum