How do I create drag and drop sprite movement on grid

0 favourites
  • 5 posts
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • Hi there, I've been looking into making some games for fun and have made some very basic games. I was wondering if anyone could put me on the right track with my latest goal.

    I need help with setting up a chess like grid or board that my sprites can move on. I want a few sprites that can move in different ways like with different pieces in chess.

    More specifically I want to be able to select a sprite, click a move and have the squares that the sprite can move to light up. then only once a valid square is clicked have the sprite move there.

    I also want to make it so that if a sprite clicks on another that is within its valid range it will do damage based on the variables for hp and damage I have setup.

    I can do this normally but with grid movement and restrictions on movement and attacking I have got myself stuck.

    Any help would be much appreciated, whether it is a link to a tutorial that my searches havent found or whether you write up an example for me.

    Thanks in advance

  • I'd say have a look at RexRainbow's grid movement:

    It does support grid based pathfinding and listing possible moves.

    For Drag&Drop, I think there are methods for finding the logical coordinates for a world coordinate. It's really quite an elaborate system, and I'm very happy with it. Don't hesitate to keep asking if you have any confusion after looking over this plugin system.

  • Thanks, I have gone through this tutorial scirra(.)com/tutorials/864/board-movements on rexrainbows gridmovement and understand it although I am have trouble moving the piece with the mouse. I have tried a few things but havent had any luck as this tutorial only covers gridmovement with arrow keys. I'm just not sure how to tell the sprite to go to a certain clicked position after selecting it. (I have set a boolean instance variable that is toggled by clicking the piece for the selection). Thanks again

  • Theres an expression for getting the Logical X and Logical Y. use Board.PXY2NearestPX(X, Y) and Board.PXY2NearestPY(X, Y)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks, I shall give it a try

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)