Score and layout selection

Get help using Construct 2

Post » Sat Feb 04, 2017 7:52 pm

Hi guys still a beginner need help please.
I have 2 questions.(i have more questions but i prefer going step by step :) )

1. i would like to use the score value to open the next layout but it's not really working.
The goal is to open the next layout with respect to the score.You can see my actual script in the image but seems not working
it always go to the ''retry'' layout (score<6 layout even if i get 12 points.
Image

2.the second question is how do i make the game automatically detect if an object/enemies or sprite are all gone out of the screen to launch the''end of layout'' .For now i'm forcing the game to end the layout after 60s which is no good for the gameplay authenticity.

3.Thanks guys
B
8
S
4
Posts: 17
Reputation: 792

Post » Sat Feb 04, 2017 9:44 pm

Checking it every 30 seconds is causing the problem. Remove that from the events and it should work.

The way you have it set it will always go to Retry level because it will send you there before you ever reach 12 points. Use a different trigger to check your score like on player dead.

Set a global variable and call it EnemyCreated and one called EnemyKilled

Each time an enemy is created add 1 to EnemyCreated and when an enemy is killed add 1 to EnemyKilled.

Every tick check to see if they are equal and if so then all enemies have been killed.

If you are spawning enemies continually you will need to stop spawning while you check if all enemies are dead.
Banned User
B
23
S
6
G
58
Posts: 1,229
Reputation: 34,540

Post » Mon Feb 06, 2017 4:56 am

Thank you for your reply. I've tried some triggers but it always seems to go to the ''retry'' layout. Please can you give an example of score checking trigger to solve this problem. As a beginner i'm pretty limited and my project seems to be a little specific. No much data related to it in the web.
B
8
S
4
Posts: 17
Reputation: 792

Post » Mon Feb 06, 2017 11:48 am

The problem is you are using <6 and checking every 30 seconds and you will always go to Retry layout because your score will always be below 6 in 30 second and will go to that layout without getting past that event.


The way to solve that is with a trigger variable.

Global Variable TRIGGER =0

SCORING >0 and SCORING <6 Set TRIGGER =1

SCORING >6 and SCORING <=8 Set TRIGGER =2

SCORING >8 and SCORING <12 Set TRIGGER =3

SCORING =12 Set TRIGGER =4


Every 30 Seconds

TRIGGER =1 Go To Layout Retry
TRIGGER =2 Go to Layout Average
TRIGGER =3 Go To Layout WINNERS
TRIGGER =4 Go To Layout Excellent

With that it only checks once at 30 seconds for you SCORING and the TRIGGER will send it to the correct layout

Remember to reset TRIGGER =0 when you go back to play or it will just keep sending you to that layout.
Banned User
B
23
S
6
G
58
Posts: 1,229
Reputation: 34,540

Post » Mon Feb 06, 2017 6:49 pm

Thanks a lot. Following your suggestion here is the new script my main problem is that i don't know where to put the ''30sec'' event and condition and how it should be, i've tried many thing but doesn't work :oops:
Image
B
8
S
4
Posts: 17
Reputation: 792

Post » Mon Feb 06, 2017 7:09 pm

Every 30 second is the Event and checking the triggers are subevents under that event

Right click on your event and add subevents.
Banned User
B
23
S
6
G
58
Posts: 1,229
Reputation: 34,540

Post » Tue Feb 07, 2017 4:04 am

Thank you for you support and time, don't hate me please It's hard to be a beginner...i've tried the sub event but nothing happen , the first picture is the script with the subevent using TRIGGERS.
Image

The second picture is not using triggers but using directly the scores and i'm wondering why the 2nd script model wouldn't work if we use subevent too? The second method is more straightforward not using triggers. But for the moment none of the 2 methods is working :(

Image
B
8
S
4
Posts: 17
Reputation: 792

Post » Tue Feb 07, 2017 8:48 am

Should work. Check your layout names.

WINNERS quotes and excellent score

You have to reset TRIGGER =0 after you go to your score layout or it will just repeat.

If the second one isn't working then check that SCORING is actually being changed when you kill an enemy.

If you want to upload your capx I will look at it.
Banned User
B
23
S
6
G
58
Posts: 1,229
Reputation: 34,540

Post » Tue Feb 07, 2017 5:31 pm

THANK YOU Lamar the second script without trigger worked it was a NOOB mistake,i've been too busy to add value to the ''score'' text and i forgot to add value to the ''scoring'' Global variable . So i endend up with a perpetual zero value of the ''SCORING'' variable etc etc
B
8
S
4
Posts: 17
Reputation: 792


Return to How do I....?

Who is online

Users browsing this forum: RobertMKD and 7 guests