How do I Generate the Pillars ONCE in an Autorunner?

Get help using Construct 2

Post » Wed Sep 13, 2017 2:10 am

The pillars are randomly generated every single time they're destroyed or the layout restarts, how can I make it so the pillars are only randomly generated in one certain way, so when they're deleted, they're all in the same positions as before?
B
9
S
1
Posts: 42
Reputation: 519

Post » Wed Sep 13, 2017 6:04 am

Maybe create 10 groups and each group has your set spawn sequence inside, then set it to randomly select one of your groups
Image
B
30
S
8
G
1
Posts: 120
Reputation: 2,862

Post » Wed Sep 13, 2017 6:17 am

I'd say something like what uzumiapps suggested. Although, instead of groups, you could have a global variable called "STAGE", and set it to 1-10 on layout start at random, then define what each stage means as sub events of your primary creation event!
B
8
S
2
G
1
Posts: 7
Reputation: 543

Post » Wed Sep 13, 2017 9:48 am

@CaesarSalad

How about this?:

https://www.dropbox.com/s/pzcukq604drys ... .capx?dl=0

This generates a random level on the fly, saving it to an array as you go - I'm saving heights, but you could swap this for sprite frames/animations, different sprites etc
Pressing the space bar will allow you to replay the level from the start; if you reach the point where you restarted in the saved level then it will continue randomly generating the level from that point.

Press R to reset the level.

If you want to permanently save the current level then you could save the dictionary to local storage, allowing you to reopen it in subsequent play sessions.
B
23
S
9
G
4
Posts: 500
Reputation: 4,417

Post » Wed Sep 13, 2017 4:45 pm

Thank you all for the comments! I'll check out everything in a few hours!

@mekonbekon Thank you especially, I'll check it out in a few hours :)
B
9
S
1
Posts: 42
Reputation: 519

Post » Wed Sep 13, 2017 9:46 pm

mekonbekon wrote:@CaesarSalad

How about this?:


This generates a random level on the fly, saving it to an array as you go - I'm saving heights, but you could swap this for sprite frames/animations, different sprites etc
Pressing the space bar will allow you to replay the level from the start; if you reach the point where you restarted in the saved level then it will continue randomly generating the level from that point.

Press R to reset the level.

If you want to permanently save the current level then you could save the dictionary to local storage, allowing you to reopen it in subsequent play sessions.


So the capx you gave me is basically exactly what I wanted, thank you very much. But I tried to incorporate this into my project and optimize it but it still isn't working properly. Here's a download to the capx www[DOT]dropbox[DOT]com/s/86q1bph11qnwowc/ScirraHelpPlease[DOT]capx?dl=0

The game overall is a bit buggy but we're just focusing on the generation part, all of that is on the bottom of the event sheet. If wanted I can add credit in the app as this is going on the Playstore. Thank you :)
B
9
S
1
Posts: 42
Reputation: 519

Post » Thu Sep 14, 2017 8:51 am

Sorry @CaesarSalad I'm still running v244 due to client work so can't view the file - could you post a screenshot of the code instead?
B
23
S
9
G
4
Posts: 500
Reputation: 4,417

Post » Thu Sep 14, 2017 11:04 am

mekonbekon wrote:Sorry @CaesarSalad I'm still running v244 due to client work so can't view the file - could you post a screenshot of the code instead?


I can at the late afternoon EST. It's 7AM here, Stay tuned.
B
9
S
1
Posts: 42
Reputation: 519

Post » Thu Sep 14, 2017 7:46 pm

mekonbekon wrote:Sorry @CaesarSalad I'm still running v244 due to client work so can't view the file - could you post a screenshot of the code instead?


So I tweaked it a bit as you can see in the "code" and this is how it turns out. Even from the original it just isn't right.

Window size 630, 360

Layout Size 630, 360

Margins 500, 500


Image

Image
B
9
S
1
Posts: 42
Reputation: 519

Post » Fri Sep 15, 2017 1:13 am

mekonbekon wrote:Sorry @CaesarSalad I'm still running v244 due to client work so can't view the file - could you post a screenshot of the code instead?


If the images sent don’t help you help me, you could always get the newest beta of Construct 2, I’ve looked everywhere to figure out how to do something like this and the Capx you gave me was genius and exactly what I needed, it just won’t work on my Capx, I think it’s a layout sizing issue but then again it just looks messed up. Looking forward to a response :D
B
9
S
1
Posts: 42
Reputation: 519

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 18 guests