How do I work with stars without array

Get help using Construct 2

Post » Tue Aug 12, 2014 11:44 am

Harishankar wrote:@animator I have followed your other post - viewtopic.php?f=147&t=111849. Now I am just wondering how to do that for this situation. @shinkan - How to add the stars to the star count only once, not every time it is achieved. And also if two stars are gained, it will says total stars gained 2. If the player plays the same level and gained three stars this time. It should say total stars gained 3 not 5 by add the new 3 stars.



I've add one line to my previous example. Now you can only add Stars that are greater than current level score.
You do not have the required permissions to view the files attached to this post.
ImageImageImageImage
B
158
S
67
G
43
Posts: 2,603
Reputation: 36,003

Post » Tue Aug 12, 2014 11:54 am

Thanks a lot. I will check soon. @shinkan You're the life saver. But sorry for asking this, is there any possibilities to do this without using arrays or dictionaries, just with global variables or greater than, lesser than conditions. Just to know, I couldn't quite catch a way.
Image
B
32
S
7
Posts: 197
Reputation: 2,537

Post » Tue Aug 12, 2014 12:12 pm

Harishankar wrote:Thanks a lot. I will check soon. @shinkan You're the life saver. But sorry for asking this, is there any possibilities to do this without using arrays or dictionaries, just with global variables or greater than, lesser than conditions. Just to know, I couldn't quite catch a way.


Yes, it is possible to do that with global variables but you would need a few for each level, and the you will have quite a lot messy event to compare and set things up.

While using dictionary you can do that a lot easier. In my example I've "pre-made" few keys at start of the first layout for simplicity, which is not optimal if you have ie. 100 levels. And here's come advantage of Dictionary over Global Variables. You can not set new Variables at runtime, but you can set new Dictionary keys at runtime. This means for every new level you can make new keys with some values and use them later in your game.

Backing up to global variable. There are few ways to set this up using only a couple of variables, but it needs a bit more knowledge and few hardcore events - do not recommend this for beginners :)
ImageImageImageImage
B
158
S
67
G
43
Posts: 2,603
Reputation: 36,003

Post » Tue Aug 12, 2014 12:33 pm

@shinkan @Harishankar thanks a lot
B
7
S
1
Posts: 51
Reputation: 507

Post » Tue Aug 12, 2014 12:35 pm

@shinkan thanks for the valuable explanation.
Image
B
32
S
7
Posts: 197
Reputation: 2,537

Post » Tue Aug 12, 2014 12:39 pm

@animator @Harishankar

You are welcome.
ImageImageImageImage
B
158
S
67
G
43
Posts: 2,603
Reputation: 36,003

Post » Tue Aug 12, 2014 5:19 pm

@shinkan sorry to bump again. When you have time to spare, Can you show me a demo of just the star count in the levels page using global variable. Don't worry about the stars to be displayed.
B
7
S
1
Posts: 51
Reputation: 507

Post » Tue Aug 12, 2014 5:45 pm

@animator
Using Global Variables instead of Dictionary?
ImageImageImageImage
B
158
S
67
G
43
Posts: 2,603
Reputation: 36,003

Post » Wed Aug 13, 2014 2:58 am

Yes just the star count in the levels page.
B
7
S
1
Posts: 51
Reputation: 507

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests