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.

We’ve made a couple of easy to use scripts that you can apply to your characters to bring them to life. Grab them from the Marketplace – the pack is called “Platform Player and Enemy AI Scripts”. (For more information using assets from the Marketplace, click here.)

Make sure that you add the pack to your game via the My Resources panel, then open the Scripts tab in the sidebar. Add the Player Platform Controls script to your player character in your level, and add the Enemy AI script to all your other characters.

applying-character-scripts

Preview your game and run around! Can you add more to these scripts? Open them up and take a look!

gf-game

 

If you have any problems with your game, make sure your terrain is all on the Tilemap layer, and your characters are on a separate layer (you can click the eye icon next to the layer name to show and hide the contents of the layer). If your characters are on the tilemap layer, you’re gonna have a bad time (the game won’t run).

characters-on-layer

 

Comments

Leave a Reply