Random values in chests

For questions about using Classic.

Post » Tue Apr 14, 2015 6:26 pm

Hey guys :geek:
So it's my 2nd game I'm trying to do (as the first one is a Brick Breaker, I don't know much about Construct but the basics :cry: ) and now I want to do a little game that would let me try random values :D . I want my character (a sprite) to open chests (sprites too) and each time he does, he discovers a random value. :D

:arrow: :arrow: :arrow: (Ex : cash x2, +100$, cash²)

I want the game to be different EACH TIME it starts. So this way, there could be high scores and stuff like that. :D
I know it sounds like a boring game but I just wanna learn. :geek:

If you could also explain me how to set up a highscore sheet that would be nice, as I don't know how to use memory with Construct. 8-) 8-) 8-)

Thanks
B
2
Posts: 6
Reputation: 164

Post » Tue Apr 14, 2015 7:12 pm

Here is a way of randomized rewards that will never be collected more than once per reward: https://dl.dropboxusercontent.com/u/471 ... werups.cap

Hope that helps!
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
116
S
41
G
17
Posts: 2,201
Reputation: 19,539

Post » Tue Apr 14, 2015 7:44 pm

Thanks,
but just to be clear, what you sent me creates a Sprite ''anywere'' on the map except on my main character, but what if i want them in the chests. I might need some more explanations than just the final result to totally get it. But it did give me some help.
B
2
Posts: 6
Reputation: 164

Post » Tue Apr 14, 2015 7:57 pm

No problem Flex, here's some more description:

The yellow powerup objects are just images that the player touches to trigger collection of an item from the array, so instead of "On collision between Player and PowerupObj" you can just trigger the event when a chest is opened/touched.

The global variable (In the project tab on the right) is how many different values there can be.

The first event under Start Of Layout just fills the array with "Powerup" and a number, eg: "Powerup1", "Powerup2", and so on.

You could just store a cash number in each of the slots instead, and then when the player reaches in to a chest it will return one of the cash values that was not already picked up before.
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit Dropbox is a pile of trash and if you need my old files PM me! :)
B
116
S
41
G
17
Posts: 2,201
Reputation: 19,539

Post » Tue Apr 14, 2015 8:03 pm

Oh ok I get it !
I'll try it and get back soon with news.
Thanks a lot for your comprehension :D
B
2
Posts: 6
Reputation: 164

Post » Tue Apr 14, 2015 10:03 pm

Well for a random value, use random(x) for a number from 0 to x, or use random(x,y) for a number from x to y.
I have no idea about high scores and stuff.
B
8
S
1
Posts: 54
Reputation: 824

Post » Wed Apr 15, 2015 12:02 am

The issue there is that there's multiple KIND of values... Some multiplying, some adding, some will be substracting... I can't just put : random(1,10)... Of course I could make something out of it but what I'm really looking for is the formula to put all these formulas in a big pool and they get mixed at the beginning of each game. That's the formula I actually need :)

But hey, thanks
B
2
Posts: 6
Reputation: 164

Post » Wed Apr 15, 2015 11:06 am

Oh right. Have you tried 'choose()'? It randomly picks one of the values between the brackets, e.g. choose("Yes","No","Maybe") could give 'Yes', 'No' or 'Maybe'.
B
8
S
1
Posts: 54
Reputation: 824

Post » Wed Apr 15, 2015 3:28 pm

Hey Flex, please don't post several duplicates of the very same topic, keep them to a single topic that's the best way to keep consistent and have all the informations you need.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
289
S
112
G
94
Posts: 7,333
Reputation: 69,287

Post » Fri Apr 17, 2015 5:36 pm

Sorry Kyatric it was my first post and I estimated I didnt post it at the right palce the first time... Won't happen again.
Thanks Sam that might help... May I post formulas in-between the parenteses?
Ex : 2"Score", "Score"²...
B
2
Posts: 6
Reputation: 164


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest