Skip to content

Gameplay Framework

RPG Map Editor ships with a small set of gameplay scripts and prefabs built on top of the map: a player you can walk around, vehicles, wandering animals, an enemy that hunts you with pathfinding, teleporters and a camera. This page says what is in it and where to find each piece.

Concept

The framework is sample gameplay. The map runtime does not need any of it, so you can use the editor and RpgMapHelper with your own character code and never touch these scripts. Most people start from the prefabs, see what they do in the demo scenes, then copy the parts they want.

It lives in four folders under Assets/CreativeSpore/RpgMapEditor/:

Folder What is in it
Scripts/RpgFramework/ Directional animation, character controllers, vehicles, AI, teleporters, damage and bullets.
Scripts/AutonomousAgents/ MovingBehaviour, the steering movement used by every character that follows a path.
Scripts/Extra/ Camera2DController, FollowObjectBehaviour and a combo box used by the in-game map editor.
Samples/Prefabs/ Ready-made characters, vehicles and props that use the scripts above.

Don't delete these folders to slim the package down. Scripts/Extra/ is used by the map itself: the in-game map editor adds a Camera2DController to the view camera if it has none. The GameObject > RpgMapEditor > Directional Animation Character menu item uses DirectionalAnimation from Scripts/RpgFramework/, so removing that folder breaks the editor scripts too.

Everything is in the CreativeSpore.RpgMapEditor namespace.

Note

The legacy character animation kit (CharAnimationController and the Char. Animation window) was removed in 1.6.1. Directional Animation replaces it.

What is in it

  • Directional Animation: a sprite sheet importer and a component that plays walk cycles in 1, 2, 4 or 8 directions.
  • Characters and Vehicles: the player controllers, collision against the map, shooting, the boat and the balloon, and the enemy spawner.
  • AI: wandering animals, companions that follow or flee from you, and an enemy that chases the player with pathfinding.
  • Teleporters: doors that move the player to another spot or another scene.
  • Camera: the pixel perfect camera and the follow behaviour.
  • Input: RpgInput, the wrapper every script reads input through.

Prefabs

All of these are in Samples/Prefabs/.

Prefab What it is
Player The main character. Walks with the arrow keys or WASD, shoots in four directions, clears fog of war around itself and can board vehicles.
PlayerTouch The same player, plus click or tap to walk there along a path found with A*.
PlayerTileMovement The same player, moving one whole tile per arrow key press instead of freely.
PlayerCamera An orthographic camera with Camera2DController and FollowObjectBehaviour, tagged MainCamera.
Boat A vehicle that sails on water. Press Enter next to it to board or leave.
Balloon A flying vehicle. It takes off when you board, ignores tile collisions and sees further through fog of war the higher it is.
ZombiePlant An enemy with FollowerAI: wanders until it sees the player, then chases them with pathfinding. Bullets damage it.
EnemyGen An ObjectGenerator that spawns ZombiePlant every 5 seconds, up to 5 alive at a time.
Bullet The projectile the player fires.
FxDead A one-shot sprite animation, spawned when an enemy dies.
Sheep An animal that wanders at random (NPCBasicAI).
Dog An animal that wanders and walks towards the player when close (CompanionAI).
Cat, Chicken Animals that wander and run away from the player when close (CompanionAI with Flee From Target on).
Teleporter A trigger that sends the player to another teleporter, in this scene or another one.
SceneSelector The scene menu of the demos (DemoGUI). Press R to reload the current scene. Only meant for the demos.

PlayerTouch and PlayerTileMovement are not used in any demo scene. Drop one into a scene with a map and a PlayerCamera to try it, in place of Player.