Check if I've been there

0 favourites
  • 6 posts
  • Hello!

    As a quick disclaimer: I'm very new to this so basic step-by-step answers would be greatly appreciated.

    I'm working on a digitalized version of a board game that is 15x10 squared and for this I need to know if my player character has already visited a certain position. I just can not figure out how to do it, anybody has the answer?

  • -bump-

  • I'd make a local variable (boolean) for each square called something like 'visited'. Set it to false by default, and then when the player is overlapping the square, set the boolean to true.

    Then you can simply check if the boolean is true or false to know if the square has been visited.

  • I thought about that but that would require 150 booleans, is there no easier way? :P

  • I thought about that but that would require 150 booleans, is there no easier way? :P

    unless your squares are separate objects you can do with just one. Instances of square object will have their own variable. :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • To further elaborate on what vee41 was saying.

    Basically you would create one sprite representing the game board.

    You could vary up the look of the piece, by using a different frame of animation for a different "look" to the piece if it has a variety of types lets say.

    Then you would give it one variable called "visited"

    When you create multiple instances of the board square, each one will then have its own "visited" variable that will keep track of itself

    then you would simply code something like this.

    player is overlapping object "board piece"

    -> set "visited" to 1

    or however your game works.

    then late you could check if its visited by doing.

    (board piece) visited = 1

    -> do this

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