Let's create an MPAGD game - Part 7 - Generating the Players Script
Updated: Oct 30, 2021
The Script Generator looks a little daunting at first, but it soon makes sense.
Basically, in MPAGD the code behind the Player and your various enemy sprites will be placed into a SPRITE EVENT file, these are just text files that contain your MPAGD scripting code.
The Script Generator tool can create these scripts for you as it has some built in scripts for basic player movement and basic enemy movements & behaviours. Fortunately these are fully customisable, plus you can write your own scripts and invent new mechanics and enemy types. As you can see from the Generator there are 8 Sprite Types for us to take advantage of, plus the Player Controls event, there's also a row for 'Other Events' (mainly scripts that will manage the game set up, loops, menus and so on...we don't need to worry about that.
For now though, we haven't started to look at enemies, all we have is our player. You can see that on the top row MPAGD has already guessed this is your player sprite:
First though, lets sort out a few things with the Player Controls row.
Click on the second column and you can cycle through the available prebuilt scripts that we can load into our game. For our game were going to select 'Platformer' - this will generate a script that handles LEFT, RIGHT and JUMP movements.
On the right hand side MPAGD has guessed our sprite images - however, we have a left facing sprite too, click on the image next to L to cycle through to the correct image.
For all of the other Sprite Types, let's get MPAGD to generate the files, but not add any code into them - to do this we need to click until it says 'Empty Template' for each of the Sprite Type events
In the last row 'Other Events' click until it says 'Auto generate'.
Now the tool should look like this:
We're nearly ready to test our 'game'. First, let's save our work
From the File menu, select Save, give your game a name, don't use any spaces.
Now go back to the Script Generator tool, if everything looks good, click Generate Scripts.