Pixel Game Maker MV Guide

Pixel Game Maker MV Guide 3 Creating a Player Character & Adding Basic Functions for Pixel Game Maker MV

Pixel Game Maker MV Guide 3 Creating a Player Character & Adding Basic Functions

Overview

Pixel Game Maker MV Guide 3 Creating a Player Character & Adding Basic Functions

Creating a Player Character & Adding Basic Functions

Part 1: Creating a Player Character Object

  1. When creating a player character object, an animation group must be assigned. Please create the needed animations according to the previous guide. If your visual assets are not ready yet, please prepare some temporary sprites and create at least 1 animation to act as a placeholder.
  2. By default, an empty project will have no Objects listed in the Objects workspace. Right click the list and select “Add Object” or click the “Add Object” button on the UI to open the Object Settings window.
  3. Currently, all objects belong either to the Player Group or Enemy Group. Object Type determines which group the object belongs to. The Player character should be assigned to the Player Group.
  4. Attack Detection Settings: By default, being assigned to the Player Group means that attacks from this object will only hit objects belonging to the Enemy Group and that have an appropriate collision box. To enable friendly fire, simply make sure the object has both groups selected for “Attack Detection Settings”.
  5. Wall Detection Impact Settings: These settings determine movement restrictions for this object. By default, enemies and tiles will block player movement, but objects in the Player Group will not.
  6. Since we are making a player-controlled character, make sure to enable the “Object Controlled by Input Device” setting!
  7. Once OK is clicked, the Object is created and the default Player Action Program will be displayed. The default actions are “Waiting”, “Jump”, and “Walk”.
  8. Look carefully and see that the “Waiting” node has rounded corners while the “Walk” and “Jump” nodes are straight corners. This indicates that “Waiting” is the default node for this Object.
  9. You’ll also see that arrows lead out from “Waiting” to the other nodes and then back to “Waiting”. This needed for a player character that needs to be on-screen waiting for player input, as it will always return to the “Waiting” node when no other action is made. However, linear logic flows are possible as well.
  10. For this guide, we will add 4 additional functions, in addition to the default 3: a Roll action, an Attack action, a Duck action, and what do to on player death.
  11. Note that this guide assumes that you have animations pre-created for all 7 actions covered by this guide!
  12. Before we add any new nodes or trigger conditions, let’s assign the correct animations to the existing three nodes. Click on the appropriate node, such as “Waiting”, and look for the “Motion” drop-down menu in the node settings panel, then select the appropriate motion from the assigned motion group. Do this for all 3 default nodes.
  13. Now let’s create our first original node by either right-clicking an empty space in the Action Programs workspace and selecting “Add Action” or by clicking the “Add Action” button in the lower right corner of the Action Programs workspace.
  14. Let’s name this new action “Attack”.
  15. Attacking should be possible from the “Waiting” action, so our next step is to create a Link between the “Waiting” action node and the new “Attack” node. To do this, right-click the “Waiting” node and select “Add Link”.
  16. Once “Add Link” is selected, a link will be drawn from the “Waiting” node to the mouse location. Simply click on the “Attack” node to assign a default link between “Waiting” and “Attack”.
  17. Click on the new arrow to display the Link Parameters panel on the right side of the screen. In the sample image, the new link is shown in red color, and colors can be freely assigned to assist with logic flow management when making a complex flow.
  18. Since the animation we are using for the attack already includes an assigned damage collision area, we only need to assign a condition triggering when the “Attack” node is accessed. So, let’s select the “The following has been input” condition and then click the plus-shaped icon to assign a key assignment. As the default condition for “Jump” is the A button, let’s assign “Attack” to the “B” button.
  19. Now we can click on the “Attack” node and select the appropriate motion from the drop-down menu, and now your player character can attack when the B button is pressed!
  20. But the current logic flow of the links means that once you attack, you are stuck in a dead end! So go ahead and right-click on “Attack” and add another link back to the “Waiting” node.
  21. Once the return Link is created, click on that Link and set the condition to “If Motion Animation Plays to the End”. This means that as soon as the attack animation is complete, the character will automatically return to the “Waiting” node.
  22. If you want to get a little more complex, go ahead and a Link from “Walk” to “Attack” to allow the character to attack during the middle of the walk action! Don’t forget to assign the B button as the Input-related Condition on this additional Link!
  23. As you create more and more nodes for complex characters, you’re going to want to spend sometime controlling the visual layout of the Nodes within the Action Program. Nodes can be dragged and dropped at any time, and Link positions can be adjusted by clicking & dragging the boxes at their start and end points.
  24. Next we create the “Roll” and Duck actions by redoing the same steps as was done for the “Attack” action, and let’s assign the X button as the Roll button, and the down direction key as the Duck button.
  25. Well, now our Action Program is getting a little crowded! Let’s avoid adding any more nodes to this main action loop, and start a new thread. We can only have 1 start Node, so let’s create a shortcut to the “Waiting” node by right-clicking on it and selecting “Create Shortcut” from the menu.
  26. A shortcut to a node allows you to divide your Nodes into more discrete groups without duplicating functionality, and is especially useful when you have a lot of different functionality needing to access a single Node, such as your character’s neutral state. And as it is just a shortcut, any changes made to the original node will automatically be reflected on the shortcuts!
  27. Congratulations! We’re still using a lot of default settings for attack damage, jump height, and HP, but we have a working character than can perform many different actions! The next guide will cover how to handle when a character is hit & the basics of when the HP reaches 0 (death).
SteamSolo.com