How do I create sprites thats contains number to operate?

0 favourites
  • 5 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hello, I want to create objects that can to be operated like,for example, sum, subtract, divide and multiply. The idea is the following one: A box that jumps must clash with coins (as mario bros). These coins have numbers as for example as 2. After must hit with another coin with an operator as +, then must hit with another coin with the second number as 3. Finally 2 coins must appear with 2 possible solutions, example 5 and 7. If it hits with the coin that contains 5, the game continues, if it hits with the coin that contains 7, the game ends. ¿How I can assign numbers to the sprites of coins that can operate and give a result?

    Thats is an example (the image not shows complete, please open the image in other tab)

    Thanks

  • Use "instance variables" on those sprites, then you can add, subtract, etc on those variables of any given sprite instance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks you, but ¿ is posible use a randoms numbers assigned to sprites?, for example once time the first coin gets 2 and in other moment gets 5, currently when the game restart. I not want create sprites of numbers, because when i operate for example 3 x 6, this result give 18, and i cannot to create a sprite for each number of range 1-100. For this raeson i want to asign random values in coins.

    Is possible?

  • Something like this?

    Example.capx

  • Yea, you can do anything you want with those variables (within the typing constraints).

    random() is a good system expression to learn.

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