How do I compare instance variables between families?

0 favourites
  • 3 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • I'm attempting to write a very crappy clone of quiz and dragons

    Subscribe to Construct videos now

    right now I have my character moving around the board according to dice rolls (Thanks to this tutorial https://www.scirra.com/tutorials/1076/h ... ake-a-dice). I keep track of the total number of spaces moved and have bounding boxes that houses an instance variable, spaceNumber, on each tile so I can move accurately according to dice rolls. Depending on which tile you land on a quiz battle ensues with that character. What I can't figure out is how can I have a family of sprites for who I'm going to battle and compare some instance variable with my bounding box so I can automatically load the picture of the right monster that I've landed on.

    I've attached a capx, please forgive me as it is a bit messy and very incomplete. Most of the features are incomplete and only laid out for debuging so they are not really attached yet or even properly separated into functions. https://drive.google.com/open?id=0B0oFU ... FBZYTZiSWM

  • Are you expecting to go to another layout for the battle? It's not quite clear but I don't think you need a family for this, you would just compare the square landed on or possible spaceNumber variable and then use this to go to the layout or battle. You could run spaceNumber through a function as a parameter that loads a certain image.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you! I had a similar thought shortly after posting this, what I ended up doing was putting all the portraits in an animation with speed 0 to sort of create an array of sprites I then just switched the frame to spaceTotal.

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