0 Favourites

# [Solved]How do I - Math - Sprite.Count*10*SpriteVariable

• 5 posts
• Could someone point me in the right direction as how I would do this?

I have a sprite, and this sprite has a variable (Level 1, 2, 3, etc)

I want to set a global variable = The amount of sprites on screen multiplied by 10, and then altered again by the sprite's variable.

I want level 1 = 10, 2 = 20, and so on.

I used = sprite.Count*10*sprite.level but nothing seems to be changing after the 10, no matter what I input, so I'm going to assume I'm doing it wrong.

• Well, the expression seems accurate enough, the only thing I can think of is if you have multiple of the same sprite from the get go, only the variable of (IIRC) the oldest one will be taken into account. So if you have 2 sprites and the initial value of the first one is level=1, and the second one is level=2, the expression will calculate as 2*10*1. This shouldn't be a problem if you're changing the value through events.

I *think*.

• Did you assign the sprite.level variable somewhere? What is it's value by default?

• Ensure they are all numerical by forcing to Int() maybe?

Although "enemy1.Count*10*Level" works for me (Level is the Global holding current level value).

Maybe show your .capx or event sheet?

• ## Buy Construct 3

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

Construct 3 users don't see these ads
• Thank you guys for replying, I think its working, but to be honest I don't know why.

I think I just had to make sure I had both local variables and global variables set in place.

I think I just got ahead of myself before I actually set up the variables. Thanks again guys.

• 5 posts