How to Add Sound to your Game

There’s a fantastic new feature in our editor, it’s an asset of the audible nature: it’s sound and music! We’ve had the code blocks for some time, but no way to add your own sounds, but now that’s all possible. Let me talk you through it.

The first thing you need is a script to trigger the sound to play. Click on “Add new” in the scripts panel.

Screen Shot 2015-10-19 at 10.04.08 am

Next you’ll need to write your script; use the code blocks to create the image below. This script simply plays some music when the object the script is attached to is created.

Screen Shot 2015-10-19 at 10.06.45 am

Save your script, giving it a name and making sure that “The Music” variable has “Public” checked.

Screen Shot 2015-10-19 at 10.09.06 am

Now we’ve got our script, we need some music to play. Open the “Asset Manager” by clicking on “Assets” in the top right of the screen (next to preview). Create a new pack or select one you own and click the “Create New Asset” button. Select “sound/audio” and upload the music you want to use. Here’s a track to get you started;

 

Screen Shot 2015-10-19 at 10.20.40 am

Once your tracks are uploaded, the only thing left to do is add them to your level! Add a new game object and attach the “Play Music” script to it. Now right click the object and select “Edit Instance Properties.”

Screen Shot 2015-10-19 at 10.27.36 am

Then select the music you want to play from the drop-down;

Screen Shot 2015-10-19 at 10.28.39 am

And that’s it! You’re all set. Hit preview and enjoy the sweet serenade of you’re in-game music. Why not give some sounds a go now? It works the exact same way, the only difference is that multiple “Play Sound” blocks can be played over top of other sounds and the sounds you play wont loop like they do with music. Good luck Gamefrooters!

 

Quick Script Tip: Make a character move with the keyboard

Note: a more up-to-date version of this tutorial can be found here: http://gamefroot.com/knowledgebase/scripting-a-top-down-player-rpg-style/

 

Hey guys, here’s a quick rundown of how to make something move around with the keyboard.

Here’s a little game I’ve started building. I drew some terrain down, and then placed a snowman (on a regular layer).

1I want to be able to move this snowman around by pressing the arrow keys, so I need to create a script. To do this, right-click on the game object, then select Add Script.

2

First I need to be able to tell when keys on the keyboard are being pressed. We can get the Event block for this under Input, Keyboard. Click on the block “When the player presses key” and drag it out into the empty workspace.

3

This block comes with backspace selected as the default key, but I want to use the arrow keys. To change the key, click on the arrow next to backspace and select right arrow from the drop down menu.

4

I want the snowman to move around, so I need to get a block specifically for movement. Blocks for movement and physics are under Game Mechanics, ArcadePhysics. Grab the “set velocity x” block and drag it into the block we placed down before. Make sure they snap together.

5

A velocity of 0 won’t move at all, so change the velocity x number to 200. 

6

Then Save the script!

7

Hit Play (in the top-right corner) to see if your scripted snowman works.

8

Wheee! When you press the right arrow key, the snowman flies off to the right. Perfect. Let’s get the other arrow key working. Click Edit (in the top-right corner) to go back to edit mode.

9

To keep working on the script we started, right-click on the snowman and select Edit script.

10

I want the snowman to stop moving when I release the arrow key, so I need to duplicate these blocks. Right-click on the yellow event block, and select Duplicate.

11

Now we have two sets of these blocks.

12

Change one of the “presses” to “releases” by clicking on it to reveal the drop down menu.

13

When the key is released, I want the movement (velocity) to go back to being still. That means I need to set velocity to 0.

14

Now we can repeat this process to make the left arrow key make the snowman move left. Duplicate the existing blocks, and change right arrow to left arrow. Also make sure you set the velocity to -200 instead of 200. A negative velocity like -200 will move the snowman to the left instead of to the right.

15

Now save this, and Play the game. Awesome! Now your snowman can move left and right. What else would you add to this script? What other things should happen to the snowman?

If you have any cool ideas, let us know in the comments below.

– Gamefroot_Dave.

Gamefroot 2.3: Best Update Ever!

Good news everyone! Building on top of our previous updates (which were slightly more under the radar, where we moved to an HTML5 game engine, integrated google blockly, implemented many user interface improvements, editor and game previewing performance, and speed boosts) we’re pleased to more overtly announce a major update.

classic-template-screenshot

Gamefroot 2.3 is the version of Gamefroot we’ve been holding out for, and now almost feature rich enough to fully replace ye old Gamefroot V1.0.

This new version introduces template games and prefabs (which we’ll explain shortly). Earlier this year we decided to move away from locking our community into creating platform games in favour of making Gamefroot both easy and powerful enough for you to make ANY type of 2D game.

In doing so we temporarily had to disable the classic drag-and-drop functionality that we’d all come to love and cherish. Well, we’re pleased to let you know that the new Classic Gamefroot Template is bringing back the easy drag-and-drop functionality that Gamefroot 1.0 had. You can choose from a variety of interactive items and characters, and place them into your game – then hit Play – and boom you got a game. It’s as easy as that.

We’ll be adding more and more functionality to this template and prefabs, with the goal of making it a complete replacement of the old Gamefroot over the coming weeks.

  • Templates: Pre-built games that you can open up and build upon – useful for learning how Gamefroot works! Template games are available from the New Game window.
  • Prefabs: Scripted game objects that are ready to use with no further scripting required – for example, a character that you can drop into your game that already has a script attached.

 

The recent changes we’ve made to Gamefroot enable you to push your game making skills further than ever. Try it out, and see what kind of awesome games you can make. Over coming weeks we’ll be posting examples showcasing what has become possible, and showing you how it’s done. Go make games!

Questions or comments? Check out 2.3.3 changelog, you can hit us up on TwitterFacebook, and the support page. Your ideas could make it into the next version of the Gamefroot Game Creator!

 

New Gamefroot Replacing Old Gamefroot

We’re really excited by how well the new version of Gamefroot has been received. Over the coming weeks, we’ll be ensuring all your games from the old Gamefroot are accessible in the new Gamefroot editor at make.gamefroot.com. Once this process is complete, we’ll be taking down the old Gamefroot so that we can focus on maintaining a single game making environment. With that focus, we can continue to make Gamefroot more powerful and easy to use.

The old Gamefroot was designed to create Flash games, but the new Gamefroot creates HTML5 / Javascript games, which means your games will run not just in your web browser, but also on modern devices such as your Android or iPhone. Old technologies become obsolete – such is the way of Flash, and the Flash games era has been rapidly drawing to a close. We realised HTML5 was going to be the future of the web, and now that future has become a reality (even Youtube has stopped displaying videos in Flash, and now uses HTML5 video).

We hope you continue to enjoy using Gamefroot. We’d love to hear your feedback, so please send us a message here with your questions or comments.

Regards,
The Gamefroot Team

Making a Moving Tile

Note: this tutorial is out of date. You can use the concepts from this tutorial, combined with this tutorial http://gamefroot.com/knowledgebase/move-it-physics-movement-and-the-constantly-loop/ to recreate this.

 

moving

An easy thing you can do to make your games more tricky to navigate is to add moving tiles. Static platforms can become boring and predictable, so why not keep the player on their toes? Here’s how we can make a moving tile.

Continue reading “Making a Moving Tile”

Make a slingshot game like Angry Birds

Note: this tutorial is out of date. You can combine the concepts here with this tutorial: http://gamefroot.com/knowledgebase/pow-shooting-projectiles-missiles-bullets-lasers/

Angry Birds is one of the most popular mobile games ever made. It’s easy to see why – with it’s simple interface, bright cartoon visuals, fun physics simulations, and endless replayability, it keeps the player wanting to get just one more piggy knocked out. But you don’t need to be a big game studio to create your own game just like it.

preview-angry

Here’s what we’re going to create.

Continue reading “Make a slingshot game like Angry Birds”

Script your Characters to bring them to life!

Note: an updated version of this tutorial is here https://www.youtube.com/watch?v=9–P9NrO9zk

 

Gamefroot has always had built-in character behaviours so that anyone can quickly and easily make a platform game – but this can turn out to be very limiting if you’re not making a platformer. So in the latest version of Gamefroot, we’ve made it so that all game objects (including characters) start out with no built-in behaviours. This requires a script to be attached to them bring them to life, which will hopefully encourage you to try out the script editor and see what you can code – it really is a lot of fun! (Learn more about using the Script Editor here.)

If you’d prefer to just place some terrain and characters in your game and be able to play that straight away, here’s an easy solution for you.

Continue reading “Script your Characters to bring them to life!”

“Hello, world!” – Easy coding with the Script Editor

Note: you can find an updated version of this tutorial here http://gamefroot.com/knowledgebase/hello-world-displaying-text/

Gamefroot’s Script Editor allows you to easily code instructions for anything in your game. We can create code as simple as making words pop up in our game that say “Hello world!”. Let’s get started.

Continue reading ““Hello, world!” – Easy coding with the Script Editor”

The New Gamefroot Script Editor – Powered by Google Blockly!

Gamefroot’s Script Editor has just been given a massive upgrade! This new version is now powered by Blockly – Google’s visual programming editor. Blockly is used by millions of people to help them learn how to code in Hour of Code educational events all over the world. And now you can learn how to use it in Gamefroot! Let’s start with the basics.

Continue reading “The New Gamefroot Script Editor – Powered by Google Blockly!”