ORK Framework Logo - RPG Editor for Unity
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • API
  • ORK 2
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get ORK

2D RPG Quickstart

  • START 2D RPG Quickstart
  • 01 Initial Setup
  • 02 Player Setup
  • 03 Music & Scenes
  • 04 UI System Setup
  • 05 UI Boxes
  • 06 Flying Texts
  • 07 Status Values
  • 08 Status Effects
  • 09 First Abilities
  • 10 Fighter Setup
  • 11 First Enemies & Battle AI
  • 12 Battle System Setup
  • 13 Animating Battle Start and End
  • 14 Random Battles
  • 15 Animating Actions
  • 16 Player Battle HUD
  • 17 Elemental Attacks
  • 18 Animating More Actions
  • 19 Inventory & Loot
  • 20 Equipment
  • 21 Loot, Start Equipment & Viewers
  • 22 Magic Abilities
  • 23 Caster Setup
  • 24 More Enemies
  • 25 Start Menu & Save Games
  • 26 Menu Screens
  • 27 Interactions
  • 28 Item Collectors
  • END 2D RPG Quickstart

3D RPG Quickstart

  • START 3D RPG Quickstart
  • 01 Initial Setup
  • 02 Player Setup
  • 03 Music & Scenes
  • 04 UI System Setup
  • 05 UI Boxes
  • 06 Flying Texts
  • 07 Status Values
  • 08 Status Effects
  • 09 First Abilities
  • 10 Fighter Setup
  • 11 First Enemies & Battle AI
  • 12 Battle System Setup
  • 13 Animating Battle Start and End
  • 14 Random Battles
  • 15 Animating Actions
  • 16 Player Battle HUD
  • 17 Elemental Attacks
  • 18 Animating More Actions
  • 19 Inventory & Loot
  • 20 Equipment
  • 21 Loot, Start Equipment & Viewers
  • 22 Magic Abilities
  • 23 Caster Setup
  • 24 More Enemies
  • 25 Start Menu & Save Games
  • 26 Menu Screens
  • 27 Interactions
  • 28 Item Collectors
  • END 3D RPG Quickstart

Status System Setup

  • START Status System Setup
  • 01 Status Values
  • 02 Status Development
  • 03 Attack/Defence Modifiers
  • 04 Status Effects
  • 05 Formulas
  • 06 Ability & Item Types
  • 07 Abilities Part 1: Attacks
  • 08 Abilities Part 2: Support & Sabotage
  • 09 Abilities Part 3: Elemental Magic
  • 10 Items
  • 11 Equipment Part 1: Slots & Slot Set Templates
  • 12 Equipment Part 2: Weapons
  • 12.5 (Optional) Equipment Part 2.5: Weapons
  • 13 Equipment Part 3: Shields, Armor & Accessories
  • 13.5 (Optional) Equipment Part 3.5: Shields, Armor & Accessories
  • 14 Equipment Part 4: Available Equipment Templates
  • 15 Loot
  • 16 Battle AIs
  • 17 Combatants Part 1: General Settings
  • 18 Combatants Part 2: Players
  • 19 Combatants Part 3: Enemies
  • 20 Combatant Groups
  • END Status System Setup

3D RPG Playground

  • START 3D RPG Playground
  • 01 Player Setup
  • 02 Start Menu
  • 03 First Interaction
  • 04 Music
  • 05 Areas
  • 06 Collecting Items
  • 07 Displaying Equipment
  • 08 Combatant Prefabs, Icons & Portraits
  • 09 Combatant Animations
  • 10 Camera Positions
  • ANIM 01 Battle Start/End Schematics
  • ANIM 02 Use, Cast & Camera
  • ANIM 03 Abilities & Items
  • ANIM 04 Physical Attacks
  • ANIM 05 Special Actions
  • BATTLE 01 Battle Menu
  • BATTLE 02 Prepare for Battle
  • TURN 01 Turn Based Setup
  • TURN 02 Turn Order HUD
  • ATB 01 Active Time Setup
  • ATB 02 Cast Times
  • ATB 03 Timebar HUD
  • BATTLE 03 The First Battle
  • BATTLE 04 Hunting Move AI
  • BATTLE 05 Spawning Combatants
  • 11 Save Games
  • MENU 01 UI Boxes
  • MENU 02 Template HUDs
  • MENU 03 Overview Menu
  • MENU 04 Menu Screens
  • 12 Shop
  • BATTLE 06 Random Battles
  • DUNGEON 01 Enter the Dungeon
  • DUNGEON 02 The Trapdoor
  • DUNGEON 03 Enemies on Level 1 & 2
  • DUNGEON 04 Traps on Level 3
  • DUNGEON 05 Going Deeper
  • 13 Bestiary (+MENU+ANIM)
  • QUEST 01 Hunting Quests (+MENU)
  • QUEST 02 Guard NPC
  • QUEST 03 Forest Ruin Cheese
  • QUEST 04 Witch NPC with Cheese
  • QUEST 05 Quest Mark HUDs
  • 14 Research Trees (+MENU)
  • CRAFT 01 Crafting Materials
  • CRAFT 02 Crafting Recipes
  • CRAFT 03 Crafting Menu
  • CRAFT 04 Crafting Proficiency & Critical Crafting
  • CRAFT 05 Materials Loot
  • 15 Changing Choice Dialogue
  • 16 Follow Me!
  • BATTLE 07 Sequence Loot Dialogue

3D Action RPG

  • START 3D Action RPG
  • 01 Status System Setup
  • 02 Player Setup
  • 03 Player Weapon
  • 04 Player Attacks
  • 05 Enemy: Chomper
  • 06 Chomper Attack
  • 07 Hit & Death
  • 08 HUDs
  • 09 Rolling on the Floor
  • 10 Enemy: Spitter
  • 11 Spit Attack
  • 12 Potion
  • 13 Grenade
  • 14 Item HUD
  • 15 Enemy: Grenadier
  • 16 Grenadier Melee Attacks
  • 17 Grenadier Flamethrower
  • 18 Item Drops
  • END 3D Action RPG

2D Grid Battle RPG

  • START 2D Grid Battle RPG
  • 01 Player Setup
  • 02 Prefab & Music Setup
  • 03 Randomizing Combatants
  • 04 UI Setup
  • 05 Battle Start, End & Phase Schematics
  • 06 Battle System Setup
  • 07 Battle Grid Setup
  • 08 Grid Move
  • 09 Forest Battle Grid
  • 10 Battle AI
  • 11 Ability Ranges
  • 12 Death & Use Schematics
  • 13 Attack Schematic
  • 14 Shoot Schematics
  • 15 Battle Selection Interaction
  • END 2D Grid Battle RPG

Schematics

  • Simple Start Schematic
  • Battle Start Schematic
  • Battle End Schematic
  • Moving to Target and Back
  • Animating a Base Attack
  • Animating a Magic Ability
  • Grid Movement
  • Open and Close UI Animations
  • Flying Text Mover

UI Setups

  • Unity UI: Initial Setup
  • Unity UI: TextMesh Pro Setup
  • Unity UI: UI Box
  • Unity UI: Flying Text
  • Unity UI: Dragging Notification
  • Unity UI: Canvas with Screen Space Camera
  • Unity UI: Interaction HUD
  • Unity UI: Simple Player HUD
  • Unity UI: Quest HUD
  • Unity UI: Shortcuts HUD
  • Unity UI: Currency HUD
  • Unity UI: Tooltip HUD
  • Unity UI: Control HUD
  • Unity UI: Attack Modifiers
  • Unity UI: Defence Modifiers

Gameplay Bits

  • Combining Input Origins
  • Combining Status Value Flying Texts
  • Fun With Flying Text
  • HUD Effects With Conditional Schematics
  • Inventory Containers
  • Multi Interaction Controllers
  • World Space HUD
  • World Space Dialogue
  • Home
  • Guide
  • Tutorials
  • 2D RPG Quickstart
  • 02 Player Setup

02 Player Setup

Table of Contents
  • Animation Types
    • 13: Use
  • Animations
    • Mecanim Settings
      • Mecanim Animaton 0
      • Mecanim Animation 1
      • Mecanim Animation 2
      • Mecanim Animation 3
  • Combatants General Settings
    • Base Settings
      • Object Variable Settings
    • Animations & Movement
      • Default Animation System
      • Default Animations
      • Default Movement Component
      • Sound Settings
  • Fighter Combatant
    • Content Information
    • Base Settings > Prefab Settings
  • Save Changes
  • Scene Setup
    • Add Game Starter
    • Add Spawn Point
      • Transform
      • Spawn Point
    • Add Camera Borders
  • Start Schematic
    • Join Group
    • Spawn ORK Player
  • Start Menu
    • New Game Settings
  • Save Changes
  • Testing
  • Combatant Prefab Setup
    • Add Face Camera Component
  • Testing

In this tutorial we’ll set up our player and spawn it in the scene.

While the player group will have 2 members, we’ll only set up one for now – the fighter. The goal of this tutorial is to be able to run around with our player.

We’ll set up:

  • animations
  • the player (combatant)
  • town scene (spawn, camera borders)
  • start game schematic

Let’s get to it!

Animation Types #

First, we’ll set up a new animation type.

Animation types are used to play animations without having to worry what that animation actually is. E.g. an Attack animation type can play different animations based on what combatant plays it, or what weapon the combatant has equipped. You can learn more about animations in this documentation.

A new project already comes with multiple default animation types, so we only need to add one more for our use (though we don’t use most of the default ones).

Navigate to Base/Control > Animation Types and add new type.

13: Use #

This’ll be used to play an animation when using an item or ability.

  • Name
    Set to Use.

Animations #

We’ll already set up the animations for all combatants – the player combatants both use the same setup, while the enemies of this tutorial series are simply sprites without any animations (and if a combatant doesn’t use an animation, it just doesn’t play it). We’re using sprites (2D) as our combatants, i.e. our animations have to be set up using Mecanim (the legacy animation system doesn’t support sprite animations).

Let’s take a look at the animator controller, you can find it in Assets/Tutorial Assets/Animations/, the Combatant Controller is the basis for all combatants (they use animator override controllers to replace animations).

Idle, Move and Attack are blend trees, looking like this:

Since we’re dealing with 2D, we need different animations for different directions, this is handled by the blend trees, which use the combatant’s rotation interpreted into a 4-directional value (0-3), which is forwarded through our animation setup (see below).

Additionally, the Use, Attack and Dead animations are played by setting Bool parameters, i.e. they’ll play until we stop the animation (which switches the parameters off) – this lets us control the duration of these animations in our schematics, which will play and stop them as needed.

The animator controller uses the following parameters:

  • Speed
    The movement speed, forwarded from our animation setup.
    Controls if idle or movement animations are used.
    This is a Float parameter.
  • Direction
    The direction the combatant is facing, forwarded from our animation setup.
    Controls which direction animation is used.
    This is a Float parameter.
  • Attack, Use and Dead
    Play the according animations while toggled on.
    These are Bool parameters.

This is just one possible setup for handling 2D animations, Mecanim and ORK are flexible and can support many different combinations and setups – ultimately, this’ll depend on what your game needs and how your combatants are moved.

Alright, let’s handle the setup in ORK. Navigate to Base/Control > Animations and change the Default animation setup.

Mecanim Settings #

We’ll forward the horizontal speed and the rotation (i.e. the direction) to the animator controller.

  • Set Horizontal Speed
    Enable this setting.
  • Horizontal Parameter
    Set to Speed.
  • Set Z Rotation
    Enable this setting.
    In 2D environments, the directional rotation is the Z-axis (for 3D it’s usually the Y-axis).
  • Rotation Type
    Select Direction 4.
    The rotation of the combatant (0 to 360, or -180 to 180) will be translated into 4 directions, 0 (east), 1 (north), 2 (west) or 3 (south).
  • Set Float Parameter
    Enable this setting.
    We’ll set a float parameter, since blend trees only work with them.
  • Paremeter Name
    Set to Direction.

We’ll now add 4 animations for attack, use, death and revive.

Mecanim Animaton 0 #

Click on Add Mecanim Animation.

  • Animation Type
    Select Attack.

Adjust the already added Animation 0. Since we play the animation via parameters and don’t need their duration, we don’t really need to set up anything beside the play/stop parameters.

Click on Add Parameter (Play).

  • Parameter Name
    Set to Attack.
  • Parameter Type
    Select Bool.
  • Bool Value
    Enable this setting.

Click on Add Parameter (Stop).

  • Parameter Name
    Set to Attack.
  • Parameter Type
    Select Bool.
  • Bool Value
    Disable this setting.

Mecanim Animation 1 #

Copy Mecanim Animation 0.

  • Animation Type
    Select Use.

We need to change the parameter names for play and stop.

  • Parameter Name (Play)
    Set to Use.
  • Parameter Name (Stop)
    Set to Use.

Mecanim Animation 2 #

Copy Mecanim Animation 1.

  • Animation Type
    Select Death.

We need to change the parameter names for play and stop.

  • Parameter Name (Play)
    Set to Dead.
  • Parameter Name (Stop)
    Set to Dead.

Mecanim Animation 3 #

Copy Mecanim Animation 2.

  • Animation Type
    Select Revive.

The revive animation will simply disable the Dead parameter when played.

  • Bool Value (Play)
    Disable this setting.

Remove the stop parameter change (Set Parameter (Stop) 0).

That’s it for the animations.

Combatants General Settings #

Next, we’ll handle some general settings for all our combatants. You can learn more about combatants in this documentation.

Navigate to Combatants > Combatants > General Settings.

Base Settings #

We’ll set up using Object Variables on our combatants. They’re variables that are bound to a combatant/game object.

We’ll later use them to show or hide an equipped weapon while attacking.

Object Variable Settings #

  • Use Object Variables
    Enable this setting.
  • Local Variables
    Enable this setting.
    This’ll make the variables unique for each instance of a combatant.
    Otherwise, all combatants sharing the same Object ID will also share the same variables and their values.

Animations & Movement #

We’ll set up Mecanim as the default animation system and use the animations we just set up.

Additionally, we’ll set up the Default Movement Component for 2D movement.

Default Animation System #

  • System Type
    Select Mecanim.

Default Animations #

Click on Add Animations.

  • Animations
    Select Default.

Default Movement Component #

We’ll use the Default movement component – it’s a very simple component, in 3D it’ll move using a Character Controller, in 2D a Rigidbody 2D component (or rather, it uses the one it finds).

  • Component Type
    Select Default.
  • Add Component
    Enable this setting.
    The movement component is automatically added if it isn’t found.
    In that case, it’ll use the setup provided here.
  • Face Target
    Enable this setting.
    The combatant will rotate into the direction it moves (in 2D on the Z-axis).
  • Smooth
    Enable this setting.
    This’ll make the movement a bit smoother.
  • Speed Smoothing
    Set to 10.
    Starting movement will not be immediately move at full speed and take a bit to reach full speed.
  • Rotation Damping
    Set to 0.
    We don’t want to smooth rotations, as it’s not needed for our 4-directional 2D animation setup.

Sound Settings #

We’ll make use of the sound types we’ve set up and assign default audio clips to them for all our combatants. The individual combatants can replace them with their own setup if you want.

You can also assign multiple audio clips to a sound type – one of the added clips will be played randomly.

The audio clips can be found in Assets/Tutorial Assets/NinjaAdventure/Sounds/Game/.

Click on Add Sound.

  • Sound Type
    Select Attack.
  • Audio Clip
    Select the Sword2 audio clip.

Click on Add Sound again.

  • Sound Type
    Select Hit.
  • Audio Clip
    Select the Hit audio clip.

Click on Add Sound again.

  • Sound Type
    Select Death.
  • Audio Clip
    Select the Spirit audio clip.

Fighter Combatant #

For now, we’ll just change the name and set up a prefab, we don’t need any status setup (other than the automatic default setup), since we don’t fight in battles yet and only want to run around.

Navigate to Combatants > Combatants and select the Default combatant.

Content Information #

  • Name
    Set to: Fighter

Base Settings > Prefab Settings #

  • Prefab
    Select the Knight prefab.
    You can find it in Assets/Tutorial Assets/NinjaAdventure/Actor/Characters/Knight/.
  • Update Mode
    Select Fixed Update.
    Our combatants are moved by Rigidbody2D components, i.e. the update mode (which determines when things like the move speed or movement direction are calculated) has to be set to update in the physics frame.
    Otherwise you’ll experience strange jumps in speed, as it’s 0 in one frame and a high value in another, since the physics frame (FixedUpdate) and the regular frame (Update) are not in sync.

Save Changes #

That’s it for the setup in the editor for now.

Don’t forget to save your changes by clicking on Save Settings at the bottom of the editor.

Scene Setup #

Open the Town scene (found in Assets/Scenes/).

We’ll add an ORK Game Starter, a Spawn Point and Camera Borders.

Add Game Starter #

First, we’ll add a game starter to the scene and set it up for quick game testing. We’ll go with the ORK Game Starter variant.

Game starters are used to initialize your project, without it, you can’t access any functionality without causing errors. You can learn more about game starters in this documentation.

You can either use the scene hierarchy context menu or the scene wizard (e.g. via CTRL + ALT + W, or using the Unity menu: Window > Gaming Is Love > Makinom Scene Wizard).

I’ll use the context menu: ORK Framework > ORK Game Starter

The added game starter should already have your Project asset set up. Change the following setting in the ORK Game Starter component’s inspector.

  • Start Game
    Enable this setting.
    This will immediately start a new game after initializing ORK.

It doesn’t really matter where you place the game starter, but it’s best to have them somewhere outside your actual level architecture to not get in the way.

Add Spawn Point #

Next, we’ll add a spawn point – we’ll spawn on the left side of town, directly by the exit.

Like the game starter, you can add a spawn point via the context menu or the scene wizard. The scene wizard has searchable popups for adding game objects or components, which can get very convenient when having to set up multiple things.

I’ll use the context menu: Makinom > Spawn Point

The spawn point will be placed directly on the ground (or whatever else is hit by the raycast into the scene) at the screen’s center – and it automatically has the next free Spawn ID assigned. Spawn IDs are used to identify a spawn point, so when we (soon) spawn our player using a schematic, that’s the spawn ID we’ll use.

Since there wasn’t a spawn point in the scene before, we’ll have the spawn ID 0 assigned.

Transform #

Change the position of the spawn point in the inspector.

  • Position
    Set to X=-18, Y=-1, Z=0.

Spawn Point #

  • Use Rotation
    Enable Z.
    We’ll use the Z-axis rotation when spawning the player on this spawn point.

Add Camera Borders #

If you look at the scene hierarchy, you’ll see 2 game objects for our camera borders:

  • Camera Border Left
  • Camera Border Right

Those two already have a Box Collider 2D set up to cover their parts of the scene – when the player moves between them, the camera will switch over.

All we need to do is add a Camera Border component to each of them using the component menu. The component offers a few settings, but we don’t need any of them for our setup.

That’s it for the scene, save your changes.

Start Schematic #

A schematic is a reusable, node-based blueprint for what you want to do. It consists of connected nodes that work similar to a flow chart – each node performs a task and decides the next node that’ll be executed. You can learn more about schematics in this Makinom documentation.

You’ll make frequent use of schematics when creating your games, e.g. to talk to an NPC, animate an action in battle or, as in this case, set up what happens at the start of a new game. We’ll cover different setups as part of this tutorial series.

Open the Makinom editor again and navigate to Schematics – it’s time to set up a simple schematic we’ll use when starting our game.

We’ll join the Fighter to the player group and spawn at the spawn point (spawn ID 0).

Join Group #

Add Node > Group > Group > Join Group

First, we’ll add Fighter to the player group. This will automatically join a combatant to the group’s battle group as well, unless no free slot is available.

  • Group Origin
    Select Active Player Group.
    This’ll join the combatant to the currently active player group.
  • Combatant
    Select Fighter.

Spawn ORK Player #

Add Node > Game > Player > Spawn ORK Player

Now, we’ll spawn the player in the scene.

  • Spawn At
    Select Spawn Point.
  • Spawn Point ID
    Set to 0.

And that’s it for the schematic. Click on Save Schematic to save it, e.g. as StartGame.

I usually save all my schematics in Assets/Schematics/ and sub folders of it.

Start Menu #

We don’t use the start menu yet (we just hit play in the Town scene), but we’ll need to set up our start schematic.

Navigate to UI > Start Menu and change the following settings.

New Game Settings #

  • Start Schematic
    Select the StartGame schematic.

Save Changes #

And that’s it – we’re ready to take our player for a test walk!

Don’t forget to save your changes by clicking on Save Settings at the bottom of the editor.

Testing #

Alright – let’s take a walk. With the Town scene still open, hit play.

Great, we spawn, can walk around and the camera border is doing it’s job … but the player’s sprite currently rotates into the movement direction … let’s fix that!

Combatant Prefab Setup #

All our (player) combatant prefabs are variants of a base prefab, so we only need to make changes to the base prefab.

Open the CombatantBase prefab for editing, you can find it in Assets/Tutorial Assets/Prefabs/Combatants/. The structure is like this:

The Mount and it’s child objects will rotate with the root (CombatantBase) into the direction the combatant moves.

However, we don’t want this for the Sprite, which displays the combatant’s sprite. To prevent this, we’ll add a Face Camera component to it.

Add Face Camera Component #

Add a Face Camera component to the CombatantBase > Sprite child object using the component menu.

  • Makinom Camera
    Enable this setting.
    This’ll face the camera that’s found by Makinom in the scene, which usually is the game’s main camera.

And that’s it for the prefab – save the changes.

Testing #

Hit play in the Town scene again.

That looks better.

 

Next, we’ll set up the game’s music and connect our scenes.

Share This Article :
  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
Updated on March 6, 2023
Table of Contents
  • Animation Types
    • 13: Use
  • Animations
    • Mecanim Settings
      • Mecanim Animaton 0
      • Mecanim Animation 1
      • Mecanim Animation 2
      • Mecanim Animation 3
  • Combatants General Settings
    • Base Settings
      • Object Variable Settings
    • Animations & Movement
      • Default Animation System
      • Default Animations
      • Default Movement Component
      • Sound Settings
  • Fighter Combatant
    • Content Information
    • Base Settings > Prefab Settings
  • Save Changes
  • Scene Setup
    • Add Game Starter
    • Add Spawn Point
      • Transform
      • Spawn Point
    • Add Camera Borders
  • Start Schematic
    • Join Group
    • Spawn ORK Player
  • Start Menu
    • New Game Settings
  • Save Changes
  • Testing
  • Combatant Prefab Setup
    • Add Face Camera Component
  • Testing
Sitemap
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • API
  • ORK 2 Hub
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get ORK
  • Contact
  • Blog
  • Makinom
  • gamingislove.com
Categories
  • News (60)
  • ORK 2 (137)
    • Tutorial (137)
      • Game tutorial (50)
      • Gameplay (32)
      • How-to (55)
  • Release (130)
Search

© 2015 Gaming is Love e.U.

Disclosure: This site may contain affiliate links, which means I may receive a commission if you click a link and purchase something that I have recommended. While clicking these links won’t cost you any money, they will help me fund my development projects while recommending great assets!