How do I improve these events

Get help using Construct 2

Post » Wed Dec 24, 2014 2:52 am

shinkan wrote:Hope I make any sens, it's almost 4 AM over here ^^


Same here... Wesołych Świąt @shinkan :D

Thanks!...
Image
B
65
S
23
G
7
Posts: 1,505
Reputation: 10,896

Post » Wed Dec 24, 2014 2:57 am

korbaach wrote:
shinkan wrote:Hope I make any sens, it's almost 4 AM over here ^^


Same here... Wesołych Świąt @shinkan :D

Thanks!...



Haha, nice! Wesołych to You too :D
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,599
Reputation: 34,835

Post » Wed Dec 24, 2014 3:01 am

shinkan wrote:@kossglobal

let's make it simpler. Imagine you have 3 variables:

1. Number variable [episode] = 1 - this will keep track of current episode you are playing
2. Number variable [level] = 1 - this will keep track of current level you are playing
3. Number variable [score] = 0 - to keep track of current player score


When player finish any level you make an event:
Dictionary: Add key "[episode] & "level" & [level]" with value [score]


So when player finish level 2 of the episode 1 and his score is 1234 it will add a key [ "1level2": 1234 ]
when he finish level 5 of episode 3 with score 5432 it will add a key [ "3level5": 5432 ]

so key name is made of a combination of: variable [episode] a string "level" and a variable [level] - which gives for example "3level1". And value of that key will be a variable [score].

Thats the point. The only thing that say what episode and level I am is my layout name. I have only one Event Sheet for all levels and 2 more (for now) that will handle the first screen and the level select screen. So the only way to know where I am is using Layout's name.

Edit: Is there a way to break the characters of layout's name?
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Wed Dec 24, 2014 3:05 am

This makes it even simpler.
Instead of this Dictionary: Add key "[episode] & "level" & [level]" with value [score]
use Dictionary: Add key "Layoutname" with value [score]
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,599
Reputation: 34,835

Post » Wed Dec 24, 2014 3:18 am

shinkan wrote:This makes it even simpler.
Instead of this Dictionary: Add key "[episode] & "level" & [level]" with value [score]
use Dictionary: Add key "Layoutname" with value [score]

Thats what I'm doing now. I save with webstorage (set local key LayoutName to ScoreTemp)
and for the dictionary (add key LayoutName with value ScoreTemp) but when I refresh the game, the data is gone

Edit: @shinkan that's how I did it. So far It's working and saved me tons of unnecessary events. So cool. Thanks for the patience.
Image
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Wed Dec 24, 2014 5:28 am

That's great!

Sorry my internet went offline for some reason and could not respond earlier :/

One thing

+Dictionary: For each key
++Dictionary: Is not empty
+++BTLevelSelect: LayoutName = Dictionary.CurrentKey

this do not need to be a sub-events
You can make only one event with this 3 conditions - works the same but takes 2 events less :)
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,599
Reputation: 34,835

Post » Wed Dec 24, 2014 6:12 am

shinkan wrote:That's great!

Sorry my internet went offline for some reason and could not respond earlier :/

One thing

+Dictionary: For each key
++Dictionary: Is not empty
+++BTLevelSelect: LayoutName = Dictionary.CurrentKey

this do not need to be a sub-events
You can make only one event with this 3 conditions - works the same but takes 2 events less :)


Thanks, I'll change it :P
Now I need some sleep. XD
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Previous

Return to How do I....?

Who is online

Users browsing this forum: amazingdream and 22 guests