How do I compare instance variables between families?

Get help using Construct 2

Post » Tue Jul 25, 2017 2:57 am

I'm attempting to write a very crappy clone of quiz and dragons https://www.youtube.com/watch?v=eBHIiV2xmaw 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
B
15
S
7
G
1
Posts: 34
Reputation: 1,793

Post » Tue Jul 25, 2017 8:15 am

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.
B
47
S
17
G
81
Posts: 2,230
Reputation: 48,107

Post » Tue Jul 25, 2017 2:15 pm

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.
B
15
S
7
G
1
Posts: 34
Reputation: 1,793


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 17 guests