NESmaker - Quick start (dale_coop's tutorial in English)

Dirk

Member
Hello! dale_coop made a tutorial in French to help getting started with NESmaker. With his permission I translated it using my sparse knowledge of French and google translate :). So please forgive any translation mistakes, I tried my best.
Thank you dale_coop for your very helpful tutorial and all the work you put in it!


INTRO

I've prepared this basic tutorial to help those who did not understand everything in Joe's tutorial videos:
http://nesmakers.com/viewforum.php?f=25

This is just a supplement. Joe shows more details than what I explain here. I strongly advise you to watch the videos corresponding to each subject, to see how it functions.

I just cover the essentials, so that it works. I can come back to some points and clarify, if necessary.



STARTING A NEW PROJECT

Run NESMaker_xxx.exe. Then choose the menu "File> New". A dialog will open:



For the creation of your new project, you have the choice between several options:
- Use Existing Tilesets: your project will directly use the images in the "GraphicAssets" folder.
- Create Blank Tilesets: Your project will use blank images that will be placed in the "GraphicAssets\<YourProjectName>" folder. Images located directly in the "GraphicAssets" folder will not be affected by your changes.
- Create Default Tilesets: Your project will use a copy of the images from "GraphicAssets" that will be placed in the "GraphicAssets\<YourProjectName>" folder. Images located directly in the "GraphicAssets" folder will not be affected by your changes.
If you chose one of the last two options, you must specify a folder name to create the "GraphicAssets\<ProjectName>" folder.


I advise you to choose "Create Blank Tilesets", to start with blank images that you can modify at your leisure.
(For example, if you enter "GAME01", a "GAME01" folder will be created in the "GraphicAssets" folder, all the necessary blank images for your game will be located in the "GraphicAssets\GAME01" folder).

After starting your new project you should save it.
For this, choose "File>Save". Since your project has never been saved before, a dialog box appears asking you where to save the file of your project (the extension of a project is .MST). By convention, it is recommended to give the same name to your project file as to your previously created project folder.

I advise you to put it in the subfolder "Projects" located at the root of the NESMaker folder (and to make the habit of saving all your projects in it, it is easier to find them and to make backups) .



INITIAL SETTING OF THE PROJECT

The project is created, but it is "blank". We will now perform the basic setup before starting the creation of our "player" and assets for our screens.

Basic Project Settings: First, choose the "Project> Project Settings" menu. Here you'll find all the settings of the project, the scripts used by your project.

- In the "Project Labels" tab, you can modify the name of the different elements of your project, these are the elements used by the editor (HMI) only, no impact on the game engine itself. We will leave the default settings.

- The "Tilesets" tab displays all the image files used by your project. We will leave the default settings

- In the "Emulator" tab, you can specify another NES emulator than that native to the editor.
I advise you to download the FCEUX emulator, to unzip it somewhere and to fill the information in this tab as follows:



Emulator: <path to fceux.exe> (browse to the FCEUX installation folder and select fceux.exe).
Working Folder: path to the folder (and ROM) of the game that will be generated, click on the browse button and select the "game.nes" file located in the "GameEngineData" folder.
Parameters: "game.nes" (automatically filled in when you select the "Working Folder").

- Then the tab "Scripts Settings". Probably the most important tab as it indicates which script should be used by the game engine for the different elements: for example what script for physics or for collisions or for sprite moves, or for picked objects, ...

By default this tab does not contain many scripts:



It is possible to add / modify these scripts by hand (indicate the type of element, the associated script ...)
However for convenience, "MODULES" with pre-defined scripts have been (and will be) created, a module for adventure games, one for platform games, one for shooters, beat'em ups ...
The current version of NESMaker comes with the "Adventure Module" which allows to create an adventure game with top-down perspective in the style of games like Zelda 1 on NES (it also comes with a more basic module also top-down, but with fewer features).

Close the Project Settings window, we will now see how to import a module, to have all the necessary scripts for our first game.

Choose the "Project> Import Project Module" menu and select the module "Modules \ AdventureModule.MOD". A dialog box will give information your project will be changed by this import.
Once confirmed, if you return to consult your "Scripts Settings" in the project settings, you will find that there are many more!


PROJECT INFO

Now choose "Project> Info" in the window that opens and check the box "Skip start screen", but ONLY this, do not touch anything else.
For now, our game will have no Start Screen and will start directly in the game (the screen with the player in it). If you do not check this box, you will have a gray screen when you launch the game (which is actually the Start Screen without any setup).



PALETTES AND PALLET GROUPS

Now that the basic setup is done, we will be able to create our different game elements (Color Palettes, Player, Tiles to compose our screens, ...).

Setting Palettes:
Before we can start with screens and our Player, we need to create at least one color palette and a group of palettes.
The color palettes will be used when you create your different sprites (your Player, the monsters), and Tiles (the elements for your screens).

In the NESMaker tree, select "Palettes> Palette Groups", right-click and choose "New palette group".



A small [+] is now displayed at the Palette Groups level, allowing you to access your new palette group (you can give it another name if you want it, for example "Level 1 Palettes")

Then, unfold the "Palettes" element to display all the palettes that can be used (for the tiles).
Select the first palette and rename it to "Main Palette" for example, then right-click on this palette and assign it to the "Level 1 Palettes" palette group.

Each element of the game can be associated with 2 palettes (except the Tiles who have 4). Each palette contains 3 colors + 1 color common to all palettes, which is used for the transparency of the sprites and is also the basic color of the screens. By default, we use black as base color, but we can choose any color we want (in Super Mario 1, the base color is blue).



PIXEL EDITOR

To be able to create your game elements Player, Tiles, Monsters, ... you must first modify the tilesets, images (bmp) containing the graphics that will be used for your game elements (currently they are empty). To create / edit these tilesets, we will open the "Pixel Editor".

Using the Pixel Editor:
In the tree view, select the "Pixel Editor". This is where we will draw the graphics.
On the left we find our palettes (by default it automatically selects the first palette of the first group of palettes): the 4 (sub) palettes of colors of your "Main Palette" are displayed here. You can modify and assign other colors for your 4 sub-pallets from your main palette.

Note that any color change made on your palettes is valid throughout the project, not just in the Pixel Editor.
I choose colors for my sub-palettes with a right-click in each color box.


That's better. This will serve me for my Tiles (trees, stones, ...)


The tilesets for the NES are represented by 4 indexed colors (represented by black, red, green, blue, which I will call "RGB" throughout this tutorial), each character, monster, tree, stone, soil, ... must be registered with these 4 colors in the tileset BMP files, otherwise it will not work. We will have to draw/modify the colors of our images so that there are only these 4 colors.
For ease of use, the Pixel Editor allows you to switch between "RGB color" and "color of the selected palette" by clicking the buttons on the toolbar.


Now let's create our "Player":
Press the Open button ("Load a BMP file") and go to the "GameObjectTiles.bmp" file located in the "GraphicAssets \ <YourProjectName>" folder (in my case in "GraphicAssets \ JEU01").
This is the file for our Player. We will draw our hero there.

The Player is a game element made up of blocks of 8x8 pixels. Depending on your ideas, you can choose to make a hero that is 8x8 or 16x8 or 16x16 or ... these blocks will be assembled to create the Player.
But for now, we have to draw these blocks.

Display the grid by pressing the [8] button.
To start drawing, use the buttons located in the toolbar (pencil, rectangle, ...). Click on the button corresponding to the color with which you want to draw (always in the toolbar at the top!).
I advise you to leave the first empty block at the top left (black), then draw a small character on 1 or more blocks.


I draw a SMILEY in 16x16. I start with the "front view" for the moment (I'll come back later for the side views, when I do the animations).

The buttons switch from "RGB color" to "color of the selected palette".


That's it, you just have to click on the "Save" button (the first diskette on the left in the toolbar)
(note: it is possible to create your sprites in Paint, copy them and then insert them in the Pixeleditor. Pressing ctrl+shift+V will snap your image to the upper left corner in the grid below your cursor, so you don't have to postion your cursor precisely).



GAME OBJECT - PLAYER


Now in "Games Objects", select "Player".
Here is the Player element of the game. By default, it is not set.

Start by giving it the desired size. In my example, I choose 2 by 2 (blocks).
You can also choose the number of frames (to animate your Player). I leave at "1" because I have drawn only one frame for my player.
Then we choose 2 different palettes for the Player from the list of accessible palettes (the player, the monsters and the items share the same list of palettes).
We will select "MonsterPalette0" and "MonsterPalette1", which we will rename respectively "Player Pal 1" and "Player Pal 2".
Then choose some colors for our palettes (right click on each color box).
That's done.



If your tileset does not appear at the top right, it might not has refreshed yet ... Wait for 2 or 3 seconds, then in the tree, click elsewhere, for example on "Overworld", then come back on "Player" ... this should refresh (Sometimes you have to go back and forth 1 or 2 times :​​p) Now, in the central part indicate the Tileset to use for each block component of the Player, (by selecting in the window at the top to right).
You can also assign a sub-palette (different or the same) to each block.


Let's go to the properties of the Player:
Click on "Object Details", this dialog box is used to set the game objects (here the Player, but you will find the same interface for monsters or items to collect).

- The first tab "Animations" is used to set different animations depending on the type of movement.


We will leave as it is for the moment.

- In the "Details" tab, you must first check the "Player" type (because our element is a player), as well as "PERSISTENT" (this object will always be loaded in memory, no matter which screen of the game is currently active).



This is very important, if you do not check these 2 boxes, you will not see your Player when the game starts.
Here you can also enter his level of health "Health" (if 0, then your Player never dies)
You MUST set his speed of movement "Speed" as well as his "acceleration", in my example, I put a speed of "40" and an acceleration of "200". (I let you change these values ​​later, if you want to test).
We do not touch the rest for now.

- The "Actions" tab, allows you to set up a sequence of actions, starting with action 0.
In the case of monsters, this allows to define a behavior, a sequence of actions that can be chained, their AI. However in the case of Player, it's a little different.
Here is the default behavior for the Adventure Module:
Action 0: This is the status of the still Player (when the player does not touch the move controls).
Action 1: This is the state of the player in motion
Action 2: This is the state of the player in attack
For each of these states, it is possible to define the animation to use, its speed, and if the state should change when it ends.
Note: As we use the Adventure Module, we need to set up action 2 so that at the end of the attack, he returns to the motionless state. For that:
Select step "2", then for "End of animation", choose "GoToFirst" and set an animation speed other than "0" (in our example, I will put "1").

- The "Bounding box" tab is used to define the Player's collision zone. Most of the time, just define a rectangle inside our Player.



Voilà our Player!


SCREEN - OVERWORLD


We will now indicate in which screen the Player will be when the game starts. A click on "Overworld" displays all the screens available to us for the game (in fact there is more, because we have access to 3 "banks" screens, as well as the Underworld).


Select a screen, for example screen 1.1 (we always start to count horizontally, then vertically ... and from 0. So here, select the screen at the intersection of the second column and the second line).
Double-click on it to open it. It's black, but that's normal (it actually displays the empty tile 0 which currently has the basic color, common to all palettes). We haven't placed any elements, because we haven't created any yet.
On the black screen, right-click in the middle and choose "Place Player". A small icon (a head) indicates the location of your Player.


HUD

Last step before you can test ...

Define the HUD:
The HUD is the part that is used to display information during the game (score, health, number of lives, ...). Although not all games display HUD, NESMaker needs this HUD set! (even if not used)
Select "HUD & Boxes", then in the first tab "HUD" define a zone for the HUD with the mouse.
For example, classic:
2 lines all the way up and click on the "HUD Area" button to define the area.
Then select the rest of the area, and click on the "Playable Area" button.


Attention!!! It is imperative that the HUD area is at least 2 lines wide (otherwise you'll encounter bugs or your project won't compile ...)


More detailed part about the HUD (including TEXT-BOX):

http://nesmakers.com/viewtopic.php?f=23&t=1332#p8582




EXPORT and TEST

We will try to launch the game to check that our Player is displayed:
In the "Test" menu, select "Export & Test" ... this will start the compilation of scripts and project settings and generate the ROM game.nes file. The command line window appears ...



And "Press a key to continue". (if any errors occur a message will be displayed with the details of the errors)

Normally, if you have followed this tutorial to the letter, the game should start, ignore the blank Start Screen and arrive directly on our screen (black) with our Player on it.




SCRIPTS FOR CONTROLS


One quickly realizes by playing with the gamepad (or the keyboard), that the Player does not move :p We will have to add scripts for movements, which will be triggered when the buttons are pressed.
NESMaker provides basic scripts allowing the movement of our player (they come with the "AdventureModule"). All scripts are in the "GameEngineData \ Routines \ UserScripts \ AdventureGame_Base" folder, which is stored in subfolders. We will use some of these scripts.

Back in NESMaker, unfold "Scripts" and select "Inputs scripts". Then in the list on the right, move to the "UserScripts \ BasicScripts \ AdventureGame_Base \ MovementScripts" folder and double-click on the "StartMovingPlayerDown.asm", "StartMovingPlayerLeft.asm", "StartMovingPlayerRight.asm", "StartMovingPlayerUp" files. asm "and" StopMovingPlayerDown.asm "," StopMovingPlayerLeft.asm "," StopMovingPlayerRight.asm "," StopMovingPlayerUp.asm ".



They should disappear from the window on the right and you should find them under "Input Scripts".


CONTROLS

Now go to "Input editor". This screen allows to assign scripts (input scripts) to button actions, depending on the current screen (Start Screen, in the game, end screen, ...)

In the "Game State" drop-down list, select "MainGame" (ie during the game). In "Target", select "NULL" (always choose NULL for all scripts, because currently this parameter is unused).
In "script to run", select the script "StartMovingPlayerDown.asm", select (with the mouse) the corresponding button on the gamepad (a red rectangle appears on the button), and click on the button "Press-Hold-Release. " (which corresponds to the state of the button: "pressed", "continously pressed", "released") so that it displays "Hold".
Then click "Add Script" to associate the motion script for moving down with pressing the down button of the gamepad while playing the game.


A new line appears in the list of assigned control commands.

Do the same for the other buttons (Left, Right, Top).
Then do the same for the "StopMovingPlayerxxx" scripts (so that the Player stops when you release the buttons) by choosing "Release" for the Press-Hold-Release button.


Voilà, it should look like this.

There is more to test ... Menu "Test> Export & Test". That's it, your player should be able to move freely.
 

Dirk

Member
TILES - PIXEL EDITOR


To realize the screens, it is necessary to create ASSETS / Tiles (trees, stones, doors, ...).

In the Pixel Editor, open the tileset "BckCHR_00.bmp" in your "GraphicAssets \ <YourProjectName>" folder.
This is the first of your tilesets that can be used to create your Assets / tiles.

Informations: There are 6 tilesets (by Bank). Note that in NESMaker each screen can only access 1 tileset at a time. So consider well how you organize your Tiles. Also note that each screen has access to special Tiles ("Screen special tiles") whose tilessets are much smaller but also more numerous (10 "Screen tilesets" by Bank).

The Tiles are composed of blocks of 16x16 pixels. Start by clicking the button [16] on the toolbar to display the different blocks.
Select the color to use (in the toolbar).
And draw the Tile.

Note that the first block (16x16) is the "empty" tile by default. When displaying a blank screen, by default, this block covers the entire screen.
So for a game with top-down view, it is advisable to make your first tile the "ground" tile (grass or ground ...)!

I draw grass as a "ground" tile and call it "Sol".


While I'm at it I draw a rock next to it.

Once finished, do not forget to save the Tileset file (the 1st small floppy disk symbol).


TILES - ASSETS


In the NESMaker tree select now "Graphics Banks> Graphics Bank 1> Assets".
This is the Tile window. By default, to create a new tile, just move to "Assets" in the tree.

Like the Player previously, we start by choosing the size of the Tile we want to create.
In my example, I will create a Tile consisting of 1 single block, which I will call "Sol" (instead of "New Asset").
On the left side of the window, my "Main Palette" is already selected (I could choose another here, if I had set others). I select which sub-palette (color scheme) I want to use for my "Sol"

In the drop-down list at the top left, I indicate what type of collision I want for EACH of the blocks that make up the Tile I'm working on.
In the case of a Tile for the ground, the player can walk on it, so choose "Null - Walkable".


Finally, create the Tile by clicking on "Save New".

Note: to modify this Tile, unfold "Assets" in the tree and select the tile "Sol".

To create my Tile "Rock", I choose 2 x 2 blocks. Then, in the central part, for each block composing the monster, I select the Tileset to use (top right), then the sub-palette of colors that correspond to my "Rock".
The type of collision, for EACH of the blocks that make up the Tile, I choose "Solid - simple": the Player will be blocked by my rock.



Create the Tile by clicking on "Save New".

Now I have two tiles to draw my game screen with.


SCREENS

In the tree view of NESMaker select "Overworld" and double-click on the game screen where you placed the Player.
The screen should no longer be black, because the default empty block is now the ground tile :p

You now have access to different Assets / Tiles, which you can use to draw on your screen.

Notes: You can switch from one screen to an adjacent one (screen above, below, to the right or to the left) using the arrow keys on your keyboard.
A small ghost area around the current screen (1 column / line), allows you to visualize how Assets / Tiles are placed in adjacent screens. You can better evaluate the collisions at the screen changes (so that your player won't get stuck in a rock when he enters a new screen)


I place some rocks on my screen (pressing CTRL or SHIFT on your keyboard let's you offset the tile relative to the cursor)

Now we have more to test ... via the menu "Test> Export & Test".
That's it, your player should be able to move a little less freely :p
 

Dirk

Member
MONSTER - PIXEL EDITOR

We are now going to create a monster.
Select the Pixel Editor, and open the file "Monster_0_00.bmp" located in your "GraphicAssets \ <YourProjectName>" folder.
This is the first of your tilesets used to create your monsters.

Information: There are 8 tilesets (per Bank, you have 2 Banks at your disposal).

The monsters are composed of 8x8 pixels tiles. Start by clicking on the button [8] of the toolbar, to display a 8x8 grid.
Select the color to use (as always in the toolbar).
And draw your monster.



In the example here, I'm going to draw only half of the monster, because I'm going to make a symmetrical monster (I'll use the same blocks twice, I'll mirror some of them horizontally to compose my monster).

Once done, save the Tileset file.



MONSTER

Now select "Monster Graphics Banks> Graphics Bank 0> Monsters" in the NESMaker tree.
This is the Monster window. By default, to create a new Monster, just click on "Monsters" in the tree (in the same way as for "Tiles").

Like the Player and Tiles previously, we start by choosing the size of the monster we want to create.

If your tileset does not appear at the top right, it's because it hasn't refreshed yet ... Wait for 2 or 3 seconds, then in the NESmaker tree, click on "Overworld", then come back to " Monsters "... it should be refreshed now (sometimes it takes one or two times going back and forth :​​p)

In my example, I will create a monster made up of 2x2 tiles, which I will call "Fantome" (instead of "New Monster").
On the left side of the window we will select "MonsterPalette1" and "MonsterPalette2" which are not used, which we will rename respectively in "Monster Pal 1" and "Monster Pal 2".

We will choose some colors for our palettes (right click on each color box).


That's done too.

Then for each part of your monster select a corresponding tile in the Tileset (top right).


You have the option to flip the tiles horizontally and/or vertically.

Finally, create the Monster by clicking "Save New" (I advise you to save the monster quickly, so you do not risk losing everything accidently by clicking unfortunately elsewhere in the NESMaker tree).
Once created, the monster appears under "Monsters" in the tree. Now, unfold "Monsters" if you have not already done so and select the "Ghost" monster. Let's go to the properties of the Monster:

Let's go to the properties of the Monster:
Then click on "Object Details". This dialog box is used to set the game objects (here, the Monster), it is exactly the same window as for the Player previously.

- The first tab "Animations" is used to set different animations depending on the type of movement.

02_Player_2.png

We will leave as it is for the moment.

- In the "Details" tab, you have to check the "Monster" type (because our element is a monster).



Leave "0" for "Health" for now, it will never die, but we do not have a way to fight the monsters yet anyway.
You MUST enter its speed "Speed" and its "acceleration". In my example, I put a speed of "25" and an acceleration of "200". (I let you change these values ​​later, if you want to test).
For "Solid Object Reaction" and "Edge Object Reaction", which correspond to the Monster's reaction when it hits a solid object or the edge of the screen respectively, we will select "Reverse Direction". So when the monster hits the screen or a block, it will turn around (if it's "NULL", the monster remains stuck immobile at the collision. If it's "Destroy Me" the monster dies/disappears).

- The "Actions" tab allows you to set a series of actions, starting with Action Step 0.
This tab is very important in the case of monsters, because here you can basically set up the monster's artificial intelligence.



Step 0 is always executed.
Through each step, we indicate which "animation type" to use, here we will keep "Default" (because we have not prepared animation for the monster yet).
Then we indicate which "Action" must be done by the monster at this step, for example: move in one of the 8 directions, stop, move from left to right, etc ... (we can obviously code and add its own actions to enrich the possibilities)
The "Timer" indicates how long this step will take. "0" corresponds to a random duration (different each time), "1" is a very short time, it corresponds to about 1/2 second, "2" to 1 second, ... "15" is the max.
The "End of Action" is triggered at the end of the Timer:
- "loop" this step does not stop (the monster continues its action indefinitely)
- "Advance" goes to the next step
- "Repeat" starts the current step again
- "GoToFirst" returns to step "0"
- "GoToLast" goes to the last step (step "7")
- "GoToPrevious" returns to the previous step
- "DestroyMe" the monster dies / disappears
- "Restart Game" the game restarts at the beginning
- "Win Game" the game is won and the end screen is displayed
The "End of Animation", offers the same thing, except that it does not take into account the Timer, but triggers at the end of the animation of the monster.

For my example, the Ghost will move from right to left (Move LR) for a random duration (0), (Advance) then stops (Stop) for a very short time (1), (Advance) then moves in one of 8 directions (Move 8 directions) for a random time (0), (Advance) then it stops again (Stop) for a very short time (1) and (GoToFirst) it starts again at the beginning.


- The "Bounding box" tab is used to define the collision zone with the Monster. Most of the time, just define a rectangle inside our Monster, just like for the Player.



Confirm by pressing the "Close" button. Done!


MONSTER GROUPS

To be used in our screens, monsters must be assigned to a group. Let's create a group so we can add the monster we've just created.

Select "Monster Graphics Banks> Graphics Bank 0> Monster Groups", the monster group creation window is displayed. Each group is composed of 1 to 4 monsters (Note that each screen can only display one group of monsters at a time).

Name the group, then using the drop-down lists select the different monsters that make up your group (you can choose from the 8 Tilesets).



In my example, I will create a group "The Bad Guys" and select my "Ghost" as the 1st monster. When finished, save the group.
Once created, the group appears under "Monster Groups" in the tree.


SCREENS - MONSTERS

In the tree structure of NESMaker, select "Overworld, and double-click on the game screen where you want to place the monsters.

Then click on "Screen Infos" button, then the "Day Monsters" tab (the daytime monsters).
In the "Day monster group" drop-down list, select the group of monsters you want to use. Then choose the color palettes corresponding to your monsters.



Validate the window by clicking on the "OK" button.

On each screen, you have the possibility to place 4 objects. These can be monsters, items to collect, effects, ... (they are "game objects", which correspond to all the Game Objects that are found in the list + the 4 Monsters of the Group of Monsters associated with the screen).



Now, where you want to place a monster, right-click, choose "Monster 1" (which is the first of 4 possible locations), then "Monster A" (which is the 1st monster of the Monster Group) associated with this screen).



Your monster is placed on your screen.

Note that you still have 3 other items to place (accessible respectively through the menus "Monster 2", "Monster 3" and "Monster 4") for each of which you can choose what you want (you can also place "Monster A" again if you want to).

We can test again ... Menu "Test> Export & Test".
That's it, for now our player can only avoid the monsters :p
 

Dirk

Member
ANIMATIONS - PLAYER

We'll go a bit more into detail on animating the Player. Let's start by drawing some animations.
The principle is to draw the sprite several times, but in different positions (like a classic drawing animation).

In the Pixel Editor:
Select the "Pixel Editor", then open the "GameObjectTiles.bmp" file located in the "GraphicAssets \ <YourProjectName>" folder (in my case in "GraphicAssets \ JEU01").

Display the grid by pressing the [8] button.
In my example I'm going to draw the player with his mouth open.

01_Pixel_Editor.png


Note: the rectangle selection tool allows you to select a zone. You can copy (CTRL + C) and paste (CTRL + V) to another location, if necessary (or from one BMP to another ... practical!).
Pressing CTRL + SHIFT + V will snap the pasted graphic to the top left corner of the grid. This is very useful, because you don't have to position your mouse cursor pixel perfect.

When finished, save the Tileset file.

In the Player window:
In the NESMaker tree select the "Player" under "Game Objects".
In our example we will create 4 animations according to our Player's directions / movements: "standing right", "standing left", "walking right", "walking left".

First, click on the "Manage Animations" button. In this dialog we declare our various animations.
By default there is already a "DefaultAnimation" animation (it's required to have at least one).
In our case, we need 4, so we'll add 3:
- click on the "Add" button, 3 times.
- select EVERY animation from the list and rename to "standing right", "standing left", "walking right", "walking left" (enter the new name and click on the "Rename" button).

02_Manage_Animations.png

(I could also add animations for when the Player walks "up" or "down" ... but I think it's enough for this tutorial, feel free to add the other animations).

After declaring the various animations, close the window. We now create the animations of our sprite.

On the left side of your Player window, a small drop-down list shows you which animation is being edited.
The first animation is already selected, it's the animation that you set up at the very beginning of the tutorial.

- For the animation "standing right" we just want a character face that does not move. So 1 frame of animation is enough.
As our animation "standing left" will be the same as "standing right" (presents our Player seen from the front) I will use copy / paste frame.
So click on the "Copy frame" button.

- Then select the animation "standing left" in the drop-down list. Your Player should normally show up all empty (This is normal, it's one of the new animations that we added, and we have not yet set).
Click now on the button "Paste frame", it will recompose in the same way as what you did for the animation "standing right".

02_Player_01.png

Note: obviously, we could make the Player like at the beginning of the tutorial by picking a tile from the Tileset (in the window located at the top right) for each block of the Player and by selecting the sub-palette to use.

- Select now "walking right", we will give our Player a little animation (for example, make him open and close his mouth when he walks).
For "Frame Count", choose "2" from the drop-down list (we need an image of the player with an open mouth and one with a closed mouth).
Then select the "frame 1", and compose the Player indicating the tiles to use (for my example, a side view of the player with opened mouth)

02_Player_02.png


Then select "frame 2" and compose the Player indicating the tiles to use (for my example, a side view of the player with closed mouth. To close the mouth I simply reuse the tile of his back, which I flip horizontally " Flip H ").

02_Player_03.png

Done.
Okay, my animation is nothing special, just one movement for the mouth ... we could also draw the movements of his body, his eyes ... (according to your imagination).

- Select "walking left". We will perform exactly the same thing as for "walking right", except that we will flip the images horizontally (so that the player is directed to the left).
For "Frame Count" choose "2" from the drop-down list.
You can use the copy / paste frame function to copy frame 1 of the "walking right" animation to frame 1 of the "walking left" animation. Repeat this for the second frame and don't forget to flip the frames so they all face to the left:

02_Player_04.png

That's it .

Now that we have realized all our animations, we have to associate them with the different directions of the player according to the type of movement.


Click on the button "Object Details" ...

The "Animations" tab displays all the types of animations that the Player will have.
By default, there is already a "Default" animation.
In our example, the Player's animation types are: "standing" and "walking".
Select "Default" animation and rename it to "standing" using the "Rename" button.
Then click on the "Add" button to add the animation type.
Now for each of the 2 types of animations we have to indicate which animation of frames to use.
Select "standing" then on the right side choose:
- "standing right" when Player moves "Down"
- "standing right" when Player moves "Down Right"
- "standing right" when Player moves "Right"
- "standing right" when Player moves "Up Right"
and
- "standing left" when Player moves "Up"
- "standing Left" when Player moves "Up Left"
- "standing left" when Player moves "Left"
- "standing Left" when Player moves "Down Left"
Fine.
Now select "walking" then on the right side choose:
- "walking right" when Player moves "Down"
- "walking right" when Player moves "Down Right"
- "walking right" when Player moves "Right"
- "walking right" when Player moves "Up Right"
and
- "walking left when Player moves "Up"
- "walking left when Player moves "Up Left"
- "walking left when Player moves "Left"
- "walking left when Player moves "Down Left"

02_Animation_Types.png

I think you understand the principle.

Now we are going to assign these types of animations to the Player steps.

Go to the "Actions" tab. As a reminder, in the case of the Player:
step 0 corresponds to the standing state of the Player
step 1 corresponds to the running/walking state of the Player
(For the Player, these steps are hard coded in the ASM scripts of the game engine)
We will now set up each action step (state of Player)
Select the Action step "0" and in "Animation Type" choose "standing"
Select Action step "1" and in "Animation Type" choose "walking". Also select a speed of animation. For our example we will choose "4".
We will not touch the other properties.

02_Player_05.png


And now, when the Player is standing, he has to display the animations of type "standing" and when he moves, he will use the animations of type "Walk".


ANIMATIONS - INPUTS SCRIPTS

To make our animations work correctly, we have to add 1 script to our project.

In the NESMaker tree under "Scripts" select "Inputs scripts". Then in the list on the right, move to the folder "UserScripts \ AdventureGame_Base \ MovementScripts" and double click on the file "ChangeToIdleAnimation.asm" (note: "ChangeToWalkingAnimation.asm" does not seem necessary in this version anymore).

This script will be used to trigger the type of animation according to the press/release of the gamepad buttons.


ANIMATIONS - INPUT EDITOR

Now go to "Input Editor".
In the "Game State" drop-down list, select "MainGame" (ie during the game). In "Target", select "NULL" (always choose NULL for all scripts, because currently this parameter is not supported).
In "script to run", select the script "ChangeToIdleAnimation.asm", select (with the mouse) the corresponding button on the controller and click on the button "Press-Hold-Release" so that it displays "Release".
Then click "Add Script" to associate the script (when releasing the button).
The corresponding line appears in the list of assigned control commands.

Do the same for the other buttons (Left, Right, Top).

Note: It does not seem necessary anymore to assign the script "ChangeToWalkingAnimation".

In the end, you should have this (the order of the lines is not too important):

03_inputs_OK.png


Now we test again ... via the "Test> Export & Test" menu.
That's it, your player should come alive now as he moves.



ANIMATIONS - MONSTERS

Normally, at this point, you should have an idea about the animations of the Monsters.
It works exactly the same way: animations for different stages of your monsters (if the monsters will move to the right or to the left, if they will be motionless, ...). No need for the INPUTS part for monsters.

I will not detail this part. Unless some people have concerns and would like clarification.
 

Dirk

Member
WEAPON - PIXEL EDITOR

We will now give our Player something to defend himself against his enemies and create weapons.

In the Pixel Editor:
Select the "Pixel Editor", then open the "GameObjectTiles.bmp" file located in the "GraphicAssets \ <YourProjectName>" folder (in my case in "GraphicAssets \ JEU01").

Display the grid by pressing the [8] button. And then, in an unused square, draw what will be your Player's Weapon.
In my example I draw a small ball.

01_projectile_pixel_editor.png


When finished save the Tileset file.


WEAPON

In the NESMaker tree, now select "Melee" under "Game Objects".
This is the object corresponding to the Player's main weapon.
Start by renaming it to "Ball". Click on the "Save" button.

01_projectile_dialog.png


Select the size of your object (here width: 1 and height: 1), then compose the Weapon by clicking on the tile to use.
In my example, I select my tile "Ball".

IMPORTANT NOTE: ALL the objects under "Game Objects" use the same 2 palettes: those of the Player!
No matter which palette you select for these game objects (other than the Player), ultimately, when the game starts, they use all the colors of the Player.
This makes it important to choose colors for the second Player sub-palette (and assign 2 different palettes for the player sub-palettes)

Note: select "Player Pal 1" for the first palette and "Player Pal 2" for the second. Now choose one or the other palette for your weapon.
For my example, I will choose the SubPal2. (If for the ball, I wished to have another color, I can return to the Pixel Editor and modify the color used for the ball)


Click on the button "Object Details" ...

- In the tab "Animations" , leave it as it is (you could make and assign animations to the Weapon, like we did previously with the Player animations).

01_projectile_Details_01.png


- In the "Detail" tab, start by checking the "player weapon" box which is the type of object we are creating.
For "Solid Object Reaction" and "Edge Object Reaction" select "Destroy Me" for the Weapon to be destroyed when it collides with a solid object or the edge of the screen.
Also indicate a speed and acceleration of your Weapon (in our example, I choose a speed of "100" and set acceleration to the maximum).

01_projectile_Details_02.png


- In the "Actions" tab, leave it as it is.

01_projectile_Details_03.png


- In the "Bounding Box" tab set a bounding box for your Weapon.

01_projectile_Details_04.png


Press the "Close" button to confirm and the Weapon is finished.
We will position the weapon according to the Player's directions.


WEAPON - POSITION

In the NESMaker tree select the item "Game Objects". The following screen should appear:

02_Offset_1.png


This screen allows you to adjust the positioning of different weapons according to the directions of the Player.

In the first drop-down list at the top, select "Down" (= when the Player is pointing down).
For the second drop-down list, select "Melee". And modify the "X Offset" and "Y offset" to correctly position the weapon in relation to the Player (keep in mind that the black is transparent).

02_Offset_down_OK.png


Then do the same for the positions "Up", "Left", "Right" (the other directions are not used in our project).

Now we only have to assign a script to trigger our weapon when a button gets pressed.


WEAPON - INPUTS SCRIPTS

To be able to trigger our Weapon, we have to add 1 script to our project.

It does not come with version 4.0.0 of NESMaker (it comes from the beta), so we will create it.

In the NESMaker tree, under "Scripts" select "Inputs scripts".
Click on the "Create" button, move to the "UserScripts \ BasicScripts \ InputScripts" folder and enter "CreateSimpleProjectileWithMotion" for filename. Click "Save".

Then, in the list on the right, move to the "UserScripts \ BasicScripts \ MovementScripts" folder and double-click on the "CreateSimpleProjectileWithMotion.ASM" files.

Finally, under "Scripts> Input Scripts", select "CreateSimpleProjectileWithMotion.ASM" and paste the script below (click on the button "SELECT ALL" then press CTLR + C to copy the code below):

Code:
CreateSimpleProjectileWithMotion:
    LDY player1_object
    CPY #$FF ;; if the player object is set to ff, he's dead.
    BNE playerCanCreateProjectile
    RTS
playerCanCreateProjectile:
    ;; get offset
    ;; in a later version, we will use user defined offsets.
    ;; for now, we'll place projectile creation at center of object
    LDA Object_movement,y
    AND #%00000111
    TAX
    LDA weaponOffsetTableX,x
    ;;; now we have the offset
     CLC
     ADC Object_x_hi,y
    STA temp1
    LDA weaponOffsetTableY,x
    CLC
    ADC Object_y_hi,y
    STA temp2
    CreateObject temp1, temp2, #$01, #$00  ;; <<== Create a Game Object 01 (=Melee)
    LDA Object_movement,y
    AND #%00000111
    STA temp
    TAY
    LDA DirectionMovementTable,y
    ORA temp

    STA Object_movement,x

    ;; add object size offset.
    LDA Object_x_hi,x
    SEC
    SBC #$08 ;; half of the width of the intended projectile
    STA Object_x_hi,x
    LDA Object_y_hi,x
    SEC
    SBC #$08 ;; half of the height of the intended projectile
    STA Object_y_hi,x

    ;;PlaySound #$00, #$00
    RTS

This script creates an object 01 (= Main Weapon) next to the Player.

Click on the "Save" button.

Note: this script (or an equivalent script) will be provided if you use a newer NESMaker version.


WEAPON - INPUT EDITOR

Now go to "Input Editor".
In the "Game State" drop-down list, select "MainGame" (ie during the game). In "Target" select "NULL" (always choose NULL for all scripts, because currently this parameter is not supported).
In "script to run", select the script "CreateSimpleProjectileWithMotion.asm", select (with the mouse) the relevant button on the controller, for example "B".

Then click on the "Press-Hold-Release" button until it displays "Press".
Finally, "Add Script" to associate the script to the button press.

03_input_OK.png

The corresponding line appears in the list of assigned control commands.


Now it's time to test again ... via the menu "Test> Export & Test".
That's it, your player should now be able to defend himself.


Note: the script provided here creates the game object 01 (= Main Weapon), but we could very well modify or duplicate this script to create another game object (02 for "projectile source", 03 for "projectile", ... )
 

Dirk

Member
Let's get back to the HUD in more detail. We will see how to add a health meter and money to our game.

HUD

In the tree view of NESMaker select "HUD & Boxes". The zone setting window is displayed.

The zones

01_HUD_settings.png


This is where we define:
- "HUD Area": ​​the area of ​the ​HUD (zone in which the elements of the HUD will be displayed). Important note: it must be at least 2 lines high and wide or you'll experience bugs
- "Playable Area": ​​the playing area, in which the Player can move around. When the Player quits this area the next screen gets loaded.
- "Textbox Area": ​​the text box display area (dialogs, etc ... one of the big new features in version 4.0.6)
- "Monster Spawn Area": ​​the area in which the monsters that are set to appear randomly will appear (the "Rand" button, for "random", in the "Edit Monster Placement Details" screen).
- "Other Area": ​​an area that does not seem to be used at the moment.

For your game, it is essential to define the first 3 zones "HUD Area", "Playable Area" and "Textbox Area". Make it a habit to do this from the beginning of the implementation of your project, because it is easy to forget and bugs will occure otherwise.

The tiles

This tab allows you to define the tiles (area of 8x8 pixels) associated with the different elements used to construct your HUD (tiles for the different letters of the alphabet, for the border of your hud, the background, some icons, ...).

It is empty By default. We will create the tilesets quickly by taking an example provided with NESMaker.

Go to "Pixel Editor":
Click on the open button and go to the "Letters_Numbers_Hud.bmp" file located in the "BetaAssets \ Graphics" folder.
Using the selection tool (next to the small pencil), select all the tilesets (drag and hold the mouse cursor from the top-left corner to the bottom-right), press CTRL + C to copy all.
Then open the file "HudTiles.bmp" located in the folder "GraphicAssets \ <NameOfYourProject>" (in my case in "GraphicAssets \ JEU01").
Position the mouse cursor at the top-left corner and press CTLR + V to paste.

And that's it, save the tilesets.

Back in "HUD & Boxes", in the tab "TileSets", you note that it is no longer empty. And normally everything is already set correctly.

02_HUD_tiles.png


(You can check by selecting each item from the list on the left to see / modify the associated tile)


Assets

You can make your own Assets in this tab to use for the contents of the HUD.
It's a set of tiles. You can use it for writting words or displaying graphics...
We won't create one for our example though.

HUD variables

This tab gives you access to the different variables of the HUD. You have 8 at your disposal.
For the Adventure module, a number of these variables are already set: "MyHealth", "MyScore", "MyKeys", "MyMoney".
If used in the HUD, they display the corresponding value.
The "UserVar_X" variables are unused for now.
Select the variable "MyHealth" and indicate "3" as initial value (note that our Player has "3" for "health" in its parameters, this is the reason why we choose the same value here).


The elements of the HUD

The tab that interests us the most, it allows you setup the HUD to your liking.
We have access to 8 possible displayable elements. For each element you can choose what it will display (a string, the value contained in a variable, an asset ...)

For the example of our game we will show the health "HEALTH" (in the form of small hearts similar to the zelda, which will disappear one by one each time the player gets hurt) and money collected "MONEY" (it will increase as soon as the palyer collects a coin).

- Select "Element 1" and choose the type "2: Text".
In "String" enter the character string that you wish to display (eg "HEALTH"). Next, change the position of the element in the HUD, using the values ​​of "X" and "Y".

04_HUD_Elements_01.png


- Now select "Element 2" (corresponding to the variable "MyHealth") and choose the type "0: Var Tiles".
Click on the button "Full Tile" to define the "tile" which will represent your filled heart, then on the button "Empty Tile" for your empty heart (I choose a *, but we could draw an empty heart in the tilesets or even use an empty tile).
Next, choose "3" for "Max value" and change the position of the element in the HUD, using the values ​​of "X" and "Y".

04_HUD_Elements_02.png


For money it's a similar principle ...
- Select "Element 6" (corresponding to an unused variable) and choose the type "2: Text".
In "String", enter the string that you want to appear (eg "MONEY"). Next, change the position of the element in the HUD, using the values ​​of "X" and "Y".
- Select "Element 5" (corresponding to the "MyMoney" variable) and choose the type "3: Number".
Next choose "3" for "Max value" and change the position of the element in the HUD, using the values ​​of "X" and "Y".

04_HUD_Elements_04.png

The HUD is ready.

We test again ... via the menu "Test> Export & Test". And find that everything is being displayed correctly.
And if the player is touched by a monster you should see his health decrease.


COLLECTABLE ITEMS - PIXEL EDITOR

We will create collectible items to replenish our health and fill our wallet.

In "Pixel Editor" open the "GameObjectTiles.bmp" file located in the "GraphicAssets \ <YourProjectName>" folder (in my case in "GraphicAssets \ JEU01").
And draw two tiles to represent your item "health" and "money" (I'm going to draw a "heart" in an empty tile and a "piece" in another).

Save your tilesets.


COLLECTABLE ITEMS - GAME OBJECTS

Now, in the NESMaker tree, under "Game Objects" select "Health Pickup".
This object is the item (collectible item) that recharges your health.

Configuration is simple:
Indicate which tile to use (our "heart"), then which palette. Attention, remember, all game objects use the Player's palettes, so you can just indicate if you want to use the 1st sub-palette or the 2nd sub-palette for your item.

05_Health_Pickup.png


Then in "Object Details", in the "Details" tab, just check the box "pickup / powerup". And define a "Bounding box".
That's it, your Item is ready.

It only remains to do exactly the same thing with the object detail "Currency Pickup".

Then you can put these elements on your screens, in addition to your tiles, your monsters ...
For that, right click "Place Monster 1> Health Pickup" or "Place Monster 1> Currency Pickup", etc.

Note that in the Adventure module, currently, when a monster is killed, it can give you a "Health Pickup" or "Currency Pickup" item. This is the default behavior encoded for the monsters in this module.
 
Top Bottom