A "Fifteen" game mechanics?

0 favourites
  • 5 posts
From the Asset Store
Create a boss fight with this easy to follow game pack. Recreate the classic attacks of Mutoid Man from Super Smash TV
  • Hello everyone!

    My name is Alex. First of all I'm very happy about being a part of this community and I'll contribute as much as I can.

    I'm new to Construct 2, so of course, there are tons of questions in the head. I'll read all FAQ's and manuals eventually, but for now I'm a bit lost.

    Currently working on a "15" game and I have no idea how to do a math part. I have some experience in programming (it was Visual Basic 5 long time ago), so some common terms and principles won't make me halt <img src="smileys/smiley36.gif" border="0" align="middle" /> .

    So here it is: How do I generate an array full of 16 random numbers (each time different order, as I remember if rnd is not properly done, it may repeat the same randomness after restart) and then assign them to 16 global variables and then place each one to a preset XY coordinates, providing I have some graphics - a field, 15 tiles and so on.

    Any help would be very much appreciated <img src="smileys/smiley9.gif" border="0" align="middle" />

  • Hello, welcome to the community.

    I'm not sure I understand what you want to do. I have two questions to make things a bit more clear, if you don't mind:

    Why do you want to add the numbers to global variables if you've already stored them in an array? Why not just refer to the array when you need the number?

    And what is it you're looking to place based on coordinates? Do you mean you want to place sprites based on values in the variables/array?

    If you could make your problem a bit more clear, I'm sure I (or someone else) can help you out.

  • Ashley sneaked in a function for array that's quite useful for this.


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you guys for a quick reply!

    R0J0hound: I tried to open fifteenGameRandomProblem.capx but it says "object type uses unknown plugin ID". As it doesn't say which one, I guess it's time to install them all <img src="smileys/smiley3.gif" border="0" align="middle" />

    Will look into other links as well.

    Nimtrix: Sorry for a confusion. What I thought was 16 points with X and Y coordinates that are bound to 16 variables, so when I shuffle them in the beginning every tile would go to appropriate coordinates. Does it make sense? <img src="smileys/smiley36.gif" border="0" align="middle" /> Can array store both X and Y for every tile?

    newt: The random in this example is absolutely the same each time I click. There are different variations upon restart though. But I need full random each time.

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