Thursday, May 4, 2023

Construct 2 vs. Stencyl: A Comprehensive Comparison

If you're a game developer, you know that choosing the right game engine is critical to the success of your project. Two of the most popular game engines on the market today are Construct 2 and Stencyl. In this article, we'll compare and contrast the two to help you make an informed decision about which one is right for your needs.



Construct 2 Overview

Construct 2 is now retired. Get construct 3 here.

Construct 2 is a game engine that's ideal for beginners who want to create 2D games. It has a drag-and-drop interface that makes it easy to create games without having to write a single line of code. Construct 2 is known for its simplicity, and it's an excellent choice for creating games quickly.

Construct 2 is a browser-based game engine, which means that you don't need to download any software to use it. You can access it from anywhere, which is great if you're working on a team or want to work on your game from different locations.



Stencyl Overview

Stencyl is another game engine that's great for beginners. Like Construct 2, it has a drag-and-drop interface that makes it easy to create games without having to write any code. However, it's more powerful than Construct 2 and can create more complex games.

Stencyl is a downloadable game engine, which means that you need to download and install it on your computer to use it. This can be an advantage if you're working on a project that requires a lot of resources, as Stencyl is more powerful than Construct 2.


Construct 2 VS Stencyl Comparison

Game Engine Pros Cons
Stencyl
  • Visual coding interface is easy to use and beginner-friendly
  • Includes built-in physics engine
  • Can export to multiple platforms, including iOS, Android, and HTML5
  • Active community with lots of user-generated resources and tutorials
  • Limited control over individual assets
  • Free version has limited functionality and includes Stencyl branding
  • Can be slow to compile and load large projects
  • Debugging can be difficult and time-consuming
Construct 2
  • Drag-and-drop interface is easy to use and beginner-friendly
  • Includes built-in physics engine
  • Exports to multiple platforms, including iOS, Android, and HTML5
  • Active community with lots of user-generated resources and tutorials
  • Limited control over individual assets
  • Free version has limited functionality and includes Construct 2 branding
  • Can be slow to compile and load large projects
  • Debugging can be difficult and time-consuming

Both Construct 2 and Stencyl are excellent game engines, but they have some key differences. Here are a few of the main differences between the two:

Ease of Use: Construct 2 is generally considered easier to use than Stencyl. Its drag-and-drop interface is very intuitive, and it's easy to create simple games quickly. Stencyl has a steeper learning curve, but it's more powerful and can create more complex games.

Features: Stencyl has more features than Construct 2. It has more advanced physics, more powerful animation tools, and more options for creating complex game mechanics. However, Construct 2 has a wider range of templates and assets, which can be helpful for beginners.

Platforms: Both Construct 2 and Stencyl can export games to a variety of platforms, including Windows, Mac, iOS, and Android. However, Stencyl can also export games to HTML5, which is useful if you want to create games that can be played in a web browser.

Price: Construct 2 is generally cheaper than Stencyl. It has a free version that's great for beginners, and a paid version that's more powerful. Stencyl has a free version, but it's more limited than the paid version, which can be expensive.



Add-Ons and Plugins for Construct 2 and Stencyl: Enhancing Your Game Development Experience

Construct 2 and Stencyl are two popular game engines that are great for beginners and experienced developers alike. Both engines offer a range of features that make it easy to create games without having to write any code. However, one of the main advantages of these engines is their flexibility when it comes to add-ons and plugins. In this article, we'll take a closer look at some of the best add-ons and plugins for both Construct 2 and Stencyl.


Construct 2 Add-Ons and Plugins

Construct 2 has a range of add-ons and plugins that can be used to enhance your game development experience. Here are a few of the most popular options:

1. SpriteFont+: This plugin allows you to use custom fonts in your game. It's easy to use and includes a range of options for customizing your font.

2. Array: This add-on makes it easy to create arrays in Construct 2. It includes a range of features for sorting, searching, and filtering arrays.

3. LiteTween: This plugin adds tweening capabilities to Construct 2. It makes it easy to create animations and transitions in your game.

4. Web Storage: This add-on allows you to store data on the user's computer. This can be useful for saving game progress or storing user preferences.

5. iFrame: This plugin allows you to embed external websites within your game. This can be useful for creating in-game ads or for providing additional information to the user.


Stencyl Add-Ons and Plugins

Stencyl also has a range of add-ons and plugins that can be used to enhance your game development experience. Here are a few of the most popular options:

1. Admob: This plugin allows you to display ads in your game. It supports a range of ad formats and includes options for customizing ad placement and frequency.

2. Box2D: This add-on adds Box2D physics to your game. It includes a range of features for creating realistic physics simulations.

3. Tiled: This plugin allows you to use Tiled maps in your game. It supports a range of map formats and includes options for customizing map layers and properties.

4. In-App Purchases: This add-on allows you to add in-app purchases to your game. It supports a range of purchase types and includes options for customizing pricing and availability.

5. Spine: This plugin allows you to use Spine animations in your game. It includes a range of features for creating complex animations and transitions.

Add-ons and plugins can be a great way to enhance your game development experience with Construct 2 or Stencyl. Whether you're looking to add new functionality to your game or simplify your development process, there are plenty of options available. By exploring the add-ons and plugins available for both engines, you can find the ones that work best for your needs and take your game development skills to the next level.

Construct 2 and Stencyl: Case Studies of Successful Games

Construct 2 and Stencyl are two popular game engines that offer users the ability to create games with ease. They are both widely used and have a number of successful games created with them. In this article, we will explore some of the most popular games created with Construct 2 and Stencyl, and analyze their success.


Construct 2 Case Studies

1. Crossy Road: Crossy Road is a popular game that was created with Construct 2. It's a simple game that involves crossing roads and dodging obstacles. It has a colorful design and is easy to play. Crossy Road was a huge success, with over 100 million downloads worldwide. The game's success was largely attributed to its simple yet addictive gameplay, and its accessibility to players of all ages.

2. Super Ubie Island: Super Ubie Island is another popular game created with Construct 2. It's a 2D platformer game that involves collecting coins and defeating enemies. The game's success was largely attributed to its colorful and fun design, as well as its challenging gameplay. Super Ubie Island received critical acclaim and was featured in numerous gaming publications.

3. Zombidle: Zombidle is a popular game that was created with Construct 2. It's a simple game that involves destroying buildings and collecting resources. The game's success was largely attributed to its humorous design and addictive gameplay. Zombidle has been downloaded millions of times and has a strong following among gamers.


Stencyl Case Studies

1. AdVenture Capitalist: AdVenture Capitalist is a popular game that was created with Stencyl. It's a simple game that involves managing a business and making money. The game's success was largely attributed to its humorous design and addictive gameplay. AdVenture Capitalist has been downloaded millions of times and has a strong following among gamers.

2. Burrito Bison: Burrito Bison is another popular game created with Stencyl. It's a 2D platformer game that involves launching a character and seeing how far they can go. The game's success was largely attributed to its humorous design and addictive gameplay. Burrito Bison received critical acclaim and was featured in numerous gaming publications.

3. Badland: Badland is a popular game that was created with Stencyl. It's a side-scrolling game that involves navigating through a dark forest. The game's success was largely attributed to its stunning visuals and immersive gameplay. Badland was critically acclaimed and won numerous awards.

Both Construct 2 and Stencyl have been used to create numerous successful games. The case studies highlighted in this article demonstrate the versatility and potential of both engines. The success of these games can be attributed to a variety of factors, including engaging gameplay, immersive design, and accessibility. By exploring these case studies, game developers can gain insight into what makes a successful game and how to achieve it with Construct 2 or Stencyl.


Conclusion

Both Construct 2 and Stencyl are excellent game engines, but they have different strengths and weaknesses. If you're a beginner who wants to create simple 2D games quickly and easily, then Construct 2 is a great choice. However, if you want to create more complex games with advanced physics and animation tools, then Stencyl is the better option.

Ultimately, the choice between Construct 2 and Stencyl depends on your needs and preferences. Take some time to explore both engines and see which one works best for you. With the right game engine, you can create amazing games that players will love.

Frequently Asked Questions about Construct 2 vs. Stencyl

What is Construct 2?

Construct 2 is a game engine that allows users to create 2D games using a drag-and-drop interface.

What is Stencyl?

Stencyl is a game engine that allows users to create 2D games using a visual coding interface.

Which game engine is better?

There is no definitive answer to this question, as both Construct 2 and Stencyl have their own strengths and weaknesses. It ultimately depends on the specific needs and preferences of the user.

Can I export games created with Construct 2 or Stencyl to multiple platforms?

Yes, both Construct 2 and Stencyl allow users to export games to multiple platforms, including iOS, Android, and HTML5.

Is there a free version of Construct 2 and Stencyl?

Yes, both Construct 2 and Stencyl offer free versions of their software, although the free versions have limited functionality and include branding for the respective game engines.

Wednesday, May 3, 2023

How to keep Your Actors From Going Off Screen

A 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?".

We all need this feature for different reasons, at different times. Some may need to stop the player actor from leaving just the sides of the screen. 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. 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.

My instance was a little more complicated than this. I am making a game that scrolls vertically. The player sprite starts at the bottom of the scene, and moves to the top of the screen. The scene is about ten times bigger in height than the standard 15 tile layout. This entails some challenges and obstacles to overcome.

First off, the default screen position is X=0 and Y=0. That would mean that the default screen position is aligned with the top left corner of the scene. Well, this doesn't do us any good, because our players roughly 5,000 pixels further down in the scene! This simple problem can be solved with the addition of a camera.

Blocks for creating a moving camera in stencylHow I solved this problem was to create a "Dummy Actor" that the camera would stay centered on. Placing the Dummy on the very bottom layer of the scene, under the background, makes him invisible to the player, but the camera will still follow him through the scene. I simply drew the dummy actor down at the bottom of the scene, right in what would be the dead center of the screen in a normal sized scene. I then drew the player actor about five tiles down, but two layers up, above the background image. Now, using a few blocks of code, we can make the dummy actor move through the scene and the camera will follow him the whole way. Since all this Dummy Actor will do is move through the scene at a set pace while the camera follows, for ease of use, I just attached these blocks in the actors events opposed to creating a separate behavior.

Now, we have our camera. If you were to test your scene at this point you would see that the camera does in fact scroll northward to the top of the scene at the pace that you set the dummy actor to move. The problem with this is that with the camera moving rapidly, but the player actor being stationary without input, it is very easy for the actor to fall off the bottom of the screen and become in active.

In order to fix this little dilemma of ours we need to incorporate some screen boundaries to stop our player actor from exiting the screen. If you followed the crash course tutorials on stencylpedia, then you should know how to set boundaries for the X position, but I will include the code anyways for those slackers out there who didn't follow those specific tuts.

Setting the Y boundaries can be a little tricky depending on the type of game that your creating. I know when I first started using stencyl, figuring out this whole boundary thing after adding a camera to the mix was a migraine headache in the making. But, with a little persistence I was able to come up with this:

How to stop your character from going off screen in stencyl

There's a few very important things to note about these blocks. One is that when you get to the Y coordinates, you don't want to use Y(on screen). You want to just use Y. The reason for this is that you will be using the Y coordinate of the camera as a starting point. The scene is 150 tiles at 32 pixels per tile. That's 4800 pixels for the height of our scene. What we did here, is we used Y of the camera to find the top boundary. That one's easy. Next, we used Y of the top corner of the camera + the screen height to find the bottom border.
Screenshot of Aero Fighter for SNES
Voila! We now have boundaries that our player character can not exceed! This method works well for Y scrolling games, like Aero Fighter, but the same might not be true for other types of games. In the next tutorial, I will show you how to modify this script to fit other game types. Until then, Cheers!

Monday, May 1, 2023

Character Building 101: How to Build a Level Up System in Stencyl

What is Character Building?


Character building is the backbone of every great RPG game ever made.It's not only for RPG's, though. Over the past decade we are seeing more and more games of different genre's dip into the realm of character building. Even first person shooters are beginning to adopt character building principles (think Borderlands).

To be concise, when I say character building, I mean that the particular game in question has a built in system where your character accumulates experience. That experience usually translates into higher attack power, higher defense, new magical abilities etc. This style of character building is more commonly known as role playing (RPG  - role playing game).

Another type of character building would be acquiring experience in one form or another, and then using that to purchase upgraded abilities (Dante's Inferno).  We will cover building a skill tree of that nature in another tutorial here in a few days.

Today, we are going to go in depth on the first idea I stated, a classic RPG style level up system. The system is pretty simple overall. We are basically going to create a character behavior to attach to our main actor, or playable character. This behavior will watch for one variable ($experience) to become greater than, or equal to, another variable ($NextLevel). Once the experience surpasses the quota for the next level, it will increment our level up one. It will then increment all of our other character attributes, like attack, defense, and max health. Once all of our character specs have been incremented, it will create a new $NextLevel value, so that the behavior can once again begin to watch for a new level up instance.

The Difference Between Getters/Setters and Game Attributes


Before we get started putting our blocks together, we need to discuss the difference between getter/setters, and game attributes. Getters and setters in stencyl are the equivalent of a variable with local scope in an actual programming language. For those of you who know a bit of programming, you already know where this is heading. For those that don't know, a variable with local scope will only function within the confines of where it's created. Sometimes this means one page of a website, or it could mean one particular function of a whole program. These types of variables are used for things that we don't need to pass on to the rest of the program.

A good example of when to use local scope in a game would be the boss battles in the old Mario games. Instead of coding a health bar and doing math to take damage, in a game like this, you could create a code block that checked how many times the boss has been hit, every time he gets hit. The code block increments the HitCount by 1. It then checks to see if the HitCount is greater than, or equal to, three. If this is the case, Bowser dies (sorry Bowser). All of this would be done locally as we don't need it to carry on to any other part of the game.
An example of how to increment damage for simpler games.

When coding a level up system, we have no use for local scope variables. They won't do us any good if they can't follow us around for the entirety of the game, no matter where the game takes us. But don't you worry your pretty little head. Like a good neighbor... global scope is there!

That's right. With a global scope, a variable and it's contents and be manipulated and called on from anywhere in the game. The stencyl equivalent of global scope is Game Attributes. To access these, while in the coding screen, click on the attribute category of blocks, and then in the sub-categories click on Game Attributes.

If we create all of our characters statistics with game attributes, we are now able to create a very simple code block that allows the game to constantly check to see if our experience is sufficient to level up. If we have enough experience to do so, that same code block will increment all of our character traits, increment the amount of experience needed to level up again, and then just for fun, it will also refill our health and energy meters to our new max health and max energy levels.



Implementation


Code blocks depicting how to create a level up system in stencyl.Now we have our very basic level up system. Our game now knows that once we accrue a certain amount of experience, to let us know that we are a little bit smarter than we were a few seconds ago (and stronger, too). Now, how do we start collecting all that experience?:Easy...peasy...Mrs. pacmans sleazy.

All we need to do is add a little bit of code to all of our enemies to define the amount of experience that they will give us if we completely and utterly destroy them (isn't that nice of them to do that?). Simply create another game attribute with a unique name, that can easily be identified as being the experience given for killing this particular enemy.


An example of how to retrieve experience from enemies in stencyl





Optionally, if you were building a much larger game where you may face the same enemies down the road, but they will be much stronger, you could increment the experience similarly to how I did in our level up blocks. You could also use this method to increment the traits of the enemy it's self, instead of creating a whole new actor with the same graphics.





What's Next?


My next few tutorials are going to walk you through the advanced mechanics of character building. Here are just a few of the topics that we are going to discuss:

  1. HUD's, or Heads Up Displays. I am going to show you how to implement health bars, energy bars, magic bars, etc.
  2.  I am going to get a little more in depth with the math behind  this level up system.
  3. Leveling up for RPG style games where you control more than one character, I.E. leveling up several playable characters separately (Final Fantasy Series).
  4. Skill Tree's ( I told ya so)
  5. Status Effects (poison, sleep, etc.)
  6. Stat boosting based on equipped items (think Diablo).
  7. Xbox style achievements
  8. And a whole lot more...

How to Keep Your Actors From Going Off Screen - Part ll: Customizing Boundaries

In the first tutorial, I showed you how I kept my player actor locked in to the camera on a vertical auto-scrolling scene. Now, as useful as that is, it doesn't really cover the whole topic of how to keep your actors from going off screen. 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.

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. I will also show you how to customize this even further to add Mario style effects for fall through's, etc.

Let's get started:

Platform Games

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. 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.

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).

Note: The exact numbers in this block of code may not be right for you. As this is just an example script I am using a standard scene size of 20 x 15 at 32 pixels per tile. You may need to adjust your numbers slightly to get the right performance for your game.







This prevents us from running backwards through the screen at the beginning of the level, as well as running straight through the end of the scene at the end of the level. Now, all we need to do is set a Y parameter for the top of the screen, and a death event that will occur when he falls off of a platform into the abyss.

This block of code prevents us from moving above the scene boundaries at the top of the screen. 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. 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.

Now, we move on to the death event. In just about 100%  of classic platform games, if you fall off the platforms into an empty space in the scene, you die. This is how I would accomplish this:

One thing to note about the above block, is that it is very basic, and not aesthetically please. Basically, in a nut shell, all this does is, if you player actor falls into a hole, it deletes him from memory. Spruce yours up with a little eye candy. When your character falls, make your block change to a special animation just for falling deaths. Also add a sound effect to it that you would use for any other kind of death event for your player actor. Now, make your block of code fade out of the scene and return to a start screen, or even better, a "Try Again?" screen.

Other Game Types

In just about any game type you will find reasons for some level of customization of the screens boundaries at some point or 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. Or, for instance, say you want to have one scene run into another. Simply set the boundary of the scene to move you to the corresponding X or Y position on the next scene.

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. Play around with your code blocks a little and see what you can come up with. 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. Until next time, Cheers!

Saturday, April 29, 2023

Character Building 101: Calculating Damage and Other Character Specs

So your characters learned to level up? Whoopty doo.


If you followed the previous tutorial then you now have a nice, basic, level up system for your game. Last time we learned how to eliminate the enemy and gain a little bit of experience in the process. That experience then accumulates and eventually causes our character to level up, which in turn alters our characters attributes slightly. If you haven't read the previous article yet, you can find it here.

Now that our characters level up from the experience that they collect, we need to develop a system for letting our increased strength and knowledge show. We need to create a math based system that allows our specs to reflect their increased value on their own. Today we are going to learn a very basic version of this just so that you can see how it works. I will probably post more on this at a later date showing a few more complicated ways to create a more in depth system. But for now, let's keep it basic.

Let's Get Started

To first get a firm understanding on what we are doing here, we are going to just focus on one part of the whole system. This will allow us to grasp what's happening and why, and then we can apply this same thing to all of the other aspects of the system with little twists if needed. The part we are going to focus on first is a very basic algorithm for calculating damage. When I say very basic, I do mean very basic

The general concept of what we are going to do is take our characters attack, add it to our weapons attack strength, and then subtract our enemies defense (like I said, very basic). The output of this function will be the amount of HP that it takes from our enemy. 
How to calculate damage to a character in stencyl

I kept it very simple with this example for the sake of understanding. Our attack is 5. Our weapon attack is 7.

5 + 7 = 12

Our enemies defense is 5

12 - 5 = 7 

The damage that we inflict is 7.

Again, this is a very basic way of doing things. For a lot of games, this would work. You wouldn't need to do much else. If your doing any kind of platform game or small scale rpg, this system would work well. If your creating a game that could compete with the Final Fantasy series, you would probably want a more complex and thorough system, which would involve incorporating several different factors into the calculation of the damage done. This usually involves things like strength, dexterity, agility and several others. I will cover all of these things and the math involved in the advanced mechanics part of this series. But for now, let's run with this.

Applying this to the Rest of our System

Once you've learned how to calculate damage done by an attack, all of the other specs of our characters will be easy to work with. To calculate the damage done to us, we would apply this same method, but opposite. We would add the enemies attack to his weapon attack if he's using one, and then subtract our defense. That would then take away from our HP.

You can calculate magic damage and things of that nature with the same method described previously. If you are looking to add elemental damage, status effects, and things like immunity and weaknesses, I will be posting another stencyl tutorial soon specifically about those topics.


What's Next?

Within the next two or three days I will be posting an in depth stencyl tutorial on skill trees. It will describe full implementation of skill trees, how to make them effect your characters stats, how to add new skills and magic to your character, and even how to apply a system of collecting points and how to spend them on your skill tree.

Introduction to Power Ups - How to boost your characters

Recently I stumbled across a question on quora.com about how to accelerate your character speed without having to write extra blocks of code to figure out exactly what direction the character is traveling.

How do I increase the acceleration of an actor in stencyl without having to know a direction?

This immediately triggered a response in my mind. It made me realize that a lot of people who are using stencyl haven't fully grasped the whole picture of what a simple variable can do! So, today, I am going to show you how you can use a couple of game variables so that your speed automatically adjusts it's self when you hit a power up in a scene.

The process of doing this is relatively simple.

1. Create your variables

You will need 6 total for this example. You will need:

  • One that contains the normal movement speed
  • One that contains the normal movement speed as a negative
  • One that contains the boosted movement speed
  • One that contains the boosted movement speed as a negative
  • One that is empty that can contain either of the positive speeds
  • One that is empty that can contain either of the negative speeds
  • A boolean variable (true or false switch) that we can use to trigger the power up
2. Create a block of code similar to these in your main characters behavior. Note that you will have to recreate this for every movement direction.
A Stencyl block showing how to form the Up button movement
A Stencyl block showing how to form the right button movement






3. Add another block to your character that looks like this.
A Stencyl block that shows how to adjust the movement speed of your character
What this block does is determine if the boolean variable $speedboost has been switched to true. If the variable becomes true, it changes the $speed variable for normal to godspeed. In this block I kept the normal movement speed at 10, and the boosted speed at 20. So when you run over the power up it doubles your movement speed. The "do after" block at the end makes it so that after ten seconds all of the movement speeds revert back to normal speed. Pretty clever!

4. Create a character that will be your power up item. 


Edit it's behavior to include a block like this:
(Note: Ignore the red flags in this block. Stencyl threw those up because I didn't add animations to this actor before creating the behaviors.)

Stencyl block that shows how to trigger the movement speed change when I power up is collided with

You may also want to add something to that block that kills the actor and removes it from the screen. I had planned to do that for this example but it slipped my mind. If anyone is unsure how to do that, just let me know in the comments and I'll cover it in another post.

That's all you need to do to change your movement speed without first calculating directions. Play around with those blocks and see what other kinds of cool things you can achieve with this principle. 

If this blog helps you out, or you just enjoy reading it, consider subscribing to my feed burner so you get immediate updates when this blog is updated. I am always looking for suggestions on what to post next that will everyone will get the most value from, so if there is anything in particular that you would like to me to explain, please let me know in the comments and I'll cover it. Thanks for reading!

Friday, April 28, 2023

How to create and use global variables in Stencyl

Variables are a very powerful thing. They are what give a programming language it's overall flexibility. Without variables, programming languages wouldn't know what to do with themselves, LITERALLY.

What is a variable?

A variable is basically a container. It can contain just about anything. It can hold numbers, strings, etc. Then you have things like boolean variables, which are true and false switches.

What can you do with a variable?

You can do a lot with variables. In stencyl specifically, you can use them to store values that get passed around from behavior to behavior. In my last post, I showed how you could create a basic power up that boosted the players movement speed for 10 seconds. We achieved this by passing values back and forth in the form of variables.

You could also use variables to create a level up system for you characters. In fact, you couldn't achieve something like that without variables.

The list is endless.

Understanding variable scope

Depending on what programming language you are using, there are several different scopes to consider. In stencyl, we only need to be concerned with two - Local and Global.

A local variable is something that usually only affects one small part of the script. For us, that could be one actor. If you create a local variable inside of an actor behavior, it can only affect that actor. In fact, in the stencyl program, you wouldn't even be able to access that variable outside of that actors behavior editor.

A Global variable is a variable that we can create that we can apply to several aspects of the game. We can take that variable and apply it to any number of characters or scenes in our game.

How do I create global variables?

In Stencyl, global variables are referred to as Game Attributes. To create them, click on the Game Attributes tab, then click the grey button that says "create new game attribute".

A display of all of the block categories in windows with the game attributes selection highlighted

Stencyl Game Attributes Menu with Create New Game Attribute highlighted





Now, you should see this pop up window:

new attribute pop up window with attribute type selection bar highlighted


As you can see, there are a handful of options here to choose from. Take your time naming variables. I can't even express to you how many times I have forgotten what a variables intended use was. Make sure that you name yours something that you will remember what they are used for!

The next thing to do is to be sure that you click the right button based on what you intend for your variable to contain. If it is meant to hold a number value, then make sure that you click number. If it is meant to hold your characters name, then make sure that you click text. You get the point.

How to use Game Attributes

Now, that you know how to create a Game Attribute, I'll give you a quick guide on how to use them. I will also expand on this in the next couple of lessons.

This is the block that I used in my last post. It shows how you can use a boolean game attribute as a trigger. In this example the trigger was pulled when the player ran over a power up. Once it was triggered it doubled the players movement speed for 10 seconds.

code block showing how to use stencyl game attributesNow you know how to create and use game attributes. In the next couple of lessons, I will show you more advanced ways to use these variables to create more flexible games. I'll see you in the next post!

If you find these Stencul tutorials helpful then please feel free to subscribe to my feed burner. If you have a lesson that you would like me to create then please let me know in the comments.

Wednesday, April 26, 2023

5 Places to get FREE Music for your Game

Note: Please read my other article: "How to get FREE Music for your Game" if you haven't already. It explains everything you need to know about the different types of licensing that these audio sites use.


The audio in your game is very important. It sets the tone for the entire game. Unless you are part of a major development studio, acquiring quality audio assets without breaking the bank can be a real challenge. Here I am giving you a short list of 5 places to get free music for your game.

1. Free Music Archive
Free Music Archive is a great place to find creative commons licensed music. They have a huge selection of audio, spanning every genre you could possibly imagine. If you can't find good tracks on FMA then you must be a damn caveman. Another bonus to this site is their licensing cheat sheet that shows you exactly what is important to you for every license type.

2. Jamendo
Although Jamendo is set up like more of an end-user service, you can still find tons of great assets on this site. Like FMA, there are tons of genres, and artists to coose from. It may take a little digging, but you are guaranteed to find something suited to your project here.
3. Magnatune

Magnatune is one that I personally use, from time to time, when I'm not writing about video game design. The selection isn't quite as extensive as some of the others, but they do have great content. I've used several tracks from here for various Youtube projects with great success.

4. Audiofarm
Audiofarm pulls artists and tracks that are offered under creative commons licenses right from Soundcloud and presents them in a clean and common sense way. I've never used Audiofarm personally, but after researching them for this article, I think I will be using them for some upcoming projects.

5. Opsound
Of all the sites listed, Opsound is one of the easier to navigate. It has a nice, clean,  minimalist design that allows you to browse their content quite efficiently. The same can be said about this site, as all the others. Great artists, great audio, and overall great selection.

I hope this was helpful to all of you reading it. If you use any of these 5 places to get free music for your game, please let me know in the comments.

Tuesday, April 25, 2023

How to get FREE Music for Your Game

Music and sound effects are arguably one of the most important assets for your game. Whether your game is on a console and blaring through surround sound, or it's playing through ear buds on an android device, the audio of your game is crucial to the overall experience. Without great audio, the overall appeal of your game could drop off dramatically.

The music in your game should create some kind of emotional response in the brain of the end user. Heavier songs are often used for boss battles because they intensify the scene and often times create a sense of urgency. Softer, more melodic tunes are used when a beloved character in your story line has died or been critically injured. Casual soundscapes create an ambient atmosphere when navigating menus and skill trees. All of these things are absolutely essential to creating the exact kind of experience that all serious developers strive for.

All of the same can be said for sound effects. Have you ever been playing a first person shooter when suddenly several loud shots come smashing through your headphones? Instant adrenaline rush. The loud clink of swords clashing make you feel like you are swinging it yourself. Even the little clicks and beeps of menu buttons are essential to building the perfect look and feel. If the sound isn't right, the game isn't either.

One of the challenges for new independant game developers is acquiring adaquate game adsets. In game development obe usually has some kind of background in either programming, graphic design, sound engineering, or story writing. It's very rare that one gets in to game development and is already proficient in all four of those fields. If you are a programmer it can be especially difficult to get your hands on qualty sounds and graphics. Luckily, there are options out there that you can take advantave of.

Before we jump into the list of valuable sources that I have for you we should discuss the different types of copyright licensing that we will potentially be working with.

1. Public Domain

Public Domain is a way of saying that some piece of work doesn't have an outright owner. Most often this happens when someone doesn't file a copyright claim on their work, or they fail to maintain those copyrights. If no one owns the rights to any particular piece of work, it is considered to be the property of the general public. If something resides in the public domain then it can be used, shared, and even sold, by ANYONE. If you go this route, you have to be 100 percent certain that the work you are using is actually in the Public Domain.

2. Creative Commons

Creative commons is similar to Public Domain in the sense that it can be shared freely, and even used commercially. Where these two differ is in that someone does own the rights to that work and are allowing the public to use it royalty free under creative commons licensing. The biggest things to remember with creative commons licensing is that you are not allowed to change the work in any way and you absolutely have to give proper credit to the original author.

The idea here is to find quality music and soumds that fit your project that are either Public Domain or Creative Commons. Either one of the two can be a viable option, so long as you are using them the right way.

Now lets move on to the list of resources: