background preloader

Tutorials

Facebook Twitter

How to make and name save game slots. In this tutorial we'll see a method to create a "Load Game" layout and an in-game screen for saving/loading with more than one slot; using Web-storage and an array. Probably there's a better way to do it, but this way works perfectly. Lets start: First the objects we'll need: 1. At least one button for saving. 2. 3. 4. 5. 6. 7. I use a "global" event sheet where I put the code that I use in every scenario, but you can do this as you wish. We'll need that when a key is pressed, the screen changes into another with all objects. "P" refers to player and "E" to enemies.

What we're doing here is stop objects movement to avoid player death or so while saving game. Next, we create the image in layer "HUD2" (A "parallax 0,0" layer wich we use to do de "hide" trick). Now we create the objects at layer HUD and the positions we desire, and set "exit button" to enabled. Now another one: What we're doing here is using a global variable as a switch "to turn off" save screen, and destroying all objects. Making an Interactive Treasure Map.

In this tutorial you'll use effects (and other stuff!) To create an interactive map that reveals locations only when the player has "discovered" them. Location hotlinks take the player from the map to corresponding levels. Each time a level is completed a new level is unlocked and revealed on the map. You can use this in adventure games or as a level loader for almost any kind of game. The project can be created with the free edition of Construct 2. The graphics used in the project, along with a completed version of the project (created using Construct 2 Release 93) can be downloaded here: TreasureMapTutorial.zip If you have trouble working with zip files, here is a link to a version of the .capx file saved with Construct 2 Release 95. TreasureMap_r95.capx The cute map feature graphics are courtesy of Dan Cook of LostGarden.com. 1. 2.

Name: Treasure MapWindow Size: 640,480 3. Name: TiledBackgroundPlugin: Tiled backgroundLayer: Layer 0Position: 0,0Size: 640, 480 4. 5. 6. 7. 8. Turret behavior - Construct 2 Manual. The Turret behavior can automatically detect objects within a certain range and rotate towards them. It optionally includes features to determine when to fire, as well as predictive aim. For examples of the Turret behavior, search for Turret in the Start dialog. How Turrets work Before a turret will target anything, you must use the Add object to target action so the object knows which objects to look for.

Calling this once on the start of layout is sufficient. You can also give the turret a Family to target, allowing it to easily target a collection of different objects. Once one of these objects enters the Turret's range (the distance between the objects is lower than the Range property), and the turret does not already have a target, then the turret acquires that object as a target. If the target leaves the turret's range, the turret will lose the target and stop firing. Predictive aim A useful feature of the Turret behavior is the ability to use predictive aim. Turret properties. Pin behavior - Construct 2 Manual.

The Pin behavior positions an object at a relative distance and angle to another object, giving the impression it has been "pinned" to the object. For examples, search for Pin in the Start dialog. Simply adding the Pin behavior to an object does not do anything. You must use the Pin action to pin the object to another object. Pin conditions Is pinnedTrue if the object is currently pinned to another object. Pin actions Pin to objectPin the object to another object. UnpinUnpin the object, so it is no longer being positioned by the Pin behavior. Pin expressions PinnedUIDGet the UID of the object currently pinned to, or -1 if not pinned. Homing missile - Scirra Forum. How to make a gravity-based platformer. There has been a bit of interest and intrigue about how I made the gravity mechanics in AirScape. So I have decided to write my first tutorial on how I did it, and show how simple it really is.

The first thing I must say, is that this method was conceived by Yann Granjon. I did not come up with the idea, I simply implemented it. He helped very much through the production of the game and it would not have been the same without him! The basics The most important thing to consider for this to work is the ability of the Platform behavior to change gravity angle. Once we know this works, the important thing to consider is, how will the game know which gravity direction to set at which point?

So Yann suggested, and I implemented, gravity zones. (Sorry for blurry pictures, they seem to have lost quality on upload) Here you can see an overview of level 1-1. These shapes are all frames of the same object, 'gravzone'. There are two types of gravzone. The code The code is very simple. Flipping 180. Physics in Construct 2: The basics. Construct 2 includes the Physics behavior, powered by Box2DWeb. This allows you to have objects moving with real-world physics - here's a demo to show the idea.

Physics can make your games really fun and engaging! Here's an overview of how you can get Physics to work in your game. If you ever took a Physics class in school, you'll find some of the things you learned applicable to Construct 2's Physics. Lots of physics examples come with Construct 2! How to add Physics Select an object you want to add Physics to. We'll call any object with the Physics behavior added a "physics object". Gravity By default, gravity is present on physics objects, which accelerates all objects downwards. Making the scenery You don't want your game's floor to fall away off the bottom of the screen with gravity too!

Most of the time in our games we want to simulate the scenery being rock solid: not falling away with gravity, and not being pushed a little bit back by things hitting it. The other physics properties. How to make Talking NPCs! Ever wanted to make an RPG, but couldn't make an NPC? Well, This is how I do make my NPCs! First, you need to have made the player, and an HUD layer. Then, put the NPC in the game. No behaviors. BUT, you need to give it one instance variable. This will tell if you have talked to this NPC already, like if the NPC gives you an Item, you don't want it to give it OVER and OVER!

Then in the HUD layer, add a bar and text on the screen like this: Do you see the NPC on screen? "System ==> Compare two Values ==> distance(Player.X, Player.Y, NPC.X, NPC.Y) Less Or Equal to 200" Ok, now we need to add an action to the Events that we added. Make the action set the text in the HUD bar "NPCNAME: Hi there! Then add 3 more actions in this order, "NPC ==> Set Talked to 1","System ==> Wait 4 seconds", and Set Text to "You: Thanks! " Remember the Events that trigger talking to the NPC? "NPC ==> Talked = 1" Then add an action to that.Add: "Set Text to "NPCNAME: Enjoy that Boat! " You have now made your first NPC! How to make a Platform game.

Jump-thru objects If you place some tiles around, you might notice if you jump in to a tile from underneath you hit your head on it and fall back down. What if you want to make platforms you can jump on to from underneath? This is what the Jump-thru behavior does. Like the Solid behavior you can stand on it with the Platform behavior, but the player can jump on to it from underneath. Let's make a Jump-thru version of our Tile object.

Use tiles 134 and 135 to make a jump-thru like this: Run the game. Hopefully you now know enough to design a whole level! Parallax Try adding a parallax effect to make the background seem further away. Conclusion This tutorial covered a lot. . - For the player's Platform behavior, always add the movement to an invisible box with no animations. Obviously we have not made a full platform game! Further reading You may be interested in the alternative beginner's guide, which is a tutorial to make a top-down shooter. Want to add music and sound effects? Asteroid clone in less than 100 events. 4 - Audio System Audio..° The user can choose if he wants sounds or not (turn it on/off)..° Music in the background, changing each wave..° Sounds on some actions (asteroid hit, asteroid destroyed, asteroid in collision with ship, wave end, ship movement, the player presses "return" in the "menus") The audio system is spread accross the project.It heavily relies on the "Audio" plugin.

(be sure to read the manual entry, as well as the entry about sound and music. You can also find elements in the how do I FAQ under the section "Audio") This kind of plugin (like Keyboard) is automaticly available in the whole project.The sounds used in the project are "stocked" in the "Audio" and "Music" folders in the "Project bar".

Be sure to check "Adding sound - A beginner's guide" to learn how to add sounds and musics in C2 that can be used with the "Audio" object.Remember that sounds can be preloaded and should be small/quick files. Event 16 testes if the global variable "Sound" is equal to 0. Building a platform game - a beginner's guide.

Wrapping it up That about finishes this first part of the tutorial - except that we'll do one more thing to make the game easier to play: I guess you've noticed that if Tim happens to miss a landing, he falls (that's another behavior that you get for free with Platform objects). If there's no floor to break his fall, he keeps going down and down until he's out of the layout altogether. To save having to run the layout again in that case, we can bring him back in again from the top (no doubt at the expense of a decline in his health, if we were scoring). Here's how: Condition: Player -> Is outside layout (under 'Size & Position')Action: Player -> Set position -> X: 370, Y: 100 That's enough to make him fall down and land on the bottom floor - but unless we also change the PlayerImages animation, he'll still appear to be falling even after he's landed.

First, add the main event: Condition: Player ->Platform On landed Now add another sub-event with the same condition: