Forum rules - please read before posting.

JRPG movement recommendation?

Hi,

I would like to make a horror game, inspired by Corpse Party
So I would like create an RPG Maker looking games with tiles, but with lot of dialouge.

I am in preproduction phase, collecting ideas and choosing tools. I already watched the Adventure Creator 2D tutorial and a huge part of 2.5D, I think this tool and Dialouge System can handle my ideas in the future.

But, I am an artist, not a programmer. As far as I see my opportunities with Adventure Creator, this RPG movement is not possible, because I don't want using navigation mesh, as far as I understand things, it's better and faster choice to me to add colliders to the tiles.

So my question is: Is better to add a standard 2D movement to the character with some kind of scripts (maybe Playmaker?), or there is a solution for this in Adventure Creator but I did not found it yet?

Thank you very much, sorry for this kind of noob question, I did not found answer for that.

Comments

  • Welcome to the community, @abysan.

    You can do this with a custom script that moves characters in a 2D grid. For a game like the one above, you'll first want to make use of Unity's Tilemap system to create your 2D scene.

    Then, set the AC Scene Manager's Pathfinding method to A Star 2D, which uses a grid system for navigation.

    Create a Tilemap specifically for the floor, and attach a Tilemap Collider (with "Is Trigger" checked) and AC's Navigation Mesh component. Reduce the Cell size so that it matches the tiles, and assign this as the Scene Manager's Default NavMesh.

    There's a few elements at play with the above, so share screenshots if you get stuck and I'll point you in the right direction.

    Once done, it's then a case of setting your Settings Manager's Movement method to None, and attaching a simple script like the one below (GridMovement.cs) to your Player character. Keep the Player in the scene and fill in their Inspector with a reference to the "floor" Tilemap created earlier:

    using UnityEngine;
    using UnityEngine.Tilemaps;
    using AC;
    
    public class GridMovement : MonoBehaviour
    {
    
        public Tilemap tilemap;
        private Grid grid;
        private Char acCharacter;
    
    
        private void Start ()
        {
            acCharacter = GetComponent <Char> ();
            grid = tilemap.transform.parent.GetComponentInParent<Grid> ();
        }
    
        void Update()
        {
            if (!KickStarter.stateHandler.IsInGameplay () 
                || (!acCharacter.IsPlayer || KickStarter.settingsManager.movementMethod == MovementMethod.PointAndClick)
                || acCharacter.IsMovingAlongPath ())
            {
                return;
            }
    
            if (acCharacter.IsPathfinding ()) return;
    
            Vector2 moveInput = new Vector2 (KickStarter.playerInput.InputGetAxis ("Horizontal"), KickStarter.playerInput.InputGetAxis ("Vertical"));
            if (moveInput.sqrMagnitude < 0.01f) return;
    
            float cellWidth = grid.cellSize.x;
            float cellHeight = grid.cellSize.y;
    
            float moveX = moveInput.x == 0 ? 0f : moveInput.x > 0f ? 1f : -1f;
            float moveY = moveInput.y == 0 ? 0f : moveInput.y > 0f ? 1f : -1f;
    
            Vector3 targetWorld = acCharacter.transform.position + new Vector3 (moveX * cellWidth, moveY * cellHeight, 0f);
            Vector3Int cellPosition = tilemap.WorldToCell (targetWorld);
    
            bool hasTile = tilemap.GetTile (cellPosition);
            if (!hasTile) return;
    
            Vector3 cellWorld = tilemap.CellToWorld (cellPosition);
            cellWorld += new Vector3 (cellWidth * 0.5f, cellHeight * 0.5f);
    
            acCharacter.MoveToPoint (cellWorld);
        }
    
    }
    
  • This is very useful and super answer, not just for me. I hope in the future other people will be able to use it well ^^ <3

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.