Keeping count of current array value and moving...

0 favourites
  • 5 posts
From the Asset Store
Be quick and count the cards and choose the right number!
  • Hi! :)

    Im currently making a board game (capx included), and I can't seem to figure out how to keep track of where my game-brick is, and using this value to move it. Lets say Brick is in the array at 0,0,1 , 0,0,0 (X and Y). How do I make this the current active slot i my array, and adding 1 to this concerning the brick moving to the right (Array (1,0,1 , 1,0,0).

    I'm sure this is hard to understand, I'm not skilled at explaining it, but if someone has an idea, I would really appreciate it!

    Thanks in advance :)

    CAPX : dropbox.com/s/yndn600xsjazsrt/BoardGame.capx

  • CurX, CurY and CurZ works only when using a for loop, otherwise, they will always have the initial value which is zero. The simplest solution would be to use instance variables with the brick or global variables to store your current X and Y dimensions of the array.

    Nice use of three dimensional array to store X and Y coordinates in the Z dimension <img src="smileys/smiley32.gif" border="0" align="middle" />.

  • you are so right... I'm thinking your tip will work, looking forward to trying it tomorrow :) Thank you, liked that one myself...

  • Hi, I'm thinking you could give the brick two variables: path and step. So, the outer circle would be path 0, then the paths towards the centre would be path 1, path 2, etc. And the inner circle could another path. And the step variable would keep track of which square along the path you are. I'm not sure how the bricks move exactly but you get the idea.

    http://dl.dropbox.com/u/8367729/construct/example/boardGameExample.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nice one! I did something similar, following Danijerry's tip, and I think I can complete it with your method :) Thanks guys!

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