[solved] would using a family solve this?

Get help using Construct 2

Post » Sat Feb 02, 2013 6:19 pm

hello again!

i've been struggling to fix this over the past few days:

what i want to happen:
- spawn 1 ground piece,
- spawn 1 gap piece,
- repeat

- i will eventually expand this to spawn ground pieces and gap pieces of set sizes but randomly so i have been using a spawn sensor to detect when they no longer overlap to spawn the next one. so when the ground piece no longer overlaps the sensor, spawn a gap, when the gap piece no longer overlaps the sensor spawn a ground piece.

would using a family solve this? (my thought is "pick all family" "family is not overlapping sensor"
or is there a better way to generate terrain, randomly but in sequence like this?

CAPX
picture of code for those without r117

sidenote: i will be buying a license eventually, i just wanted to wait until i had a game closer to completion but if families can solve this i would consider buying one now.wretchedshark2013-02-02 21:59:25
B
14
S
6
G
2
Posts: 136
Reputation: 3,210

Post » Sat Feb 02, 2013 7:33 pm

Didn't look at your Capx yet, and beeing a noob to Construct 2 myself I'm not sure if this helps. Hoping so.

I created a family (Heroes) of several sprites.
Then I created heroes with something very similar to this:

system -> Create object Heroes on layer 1 (10,10)   
=First hero needs a postition

system -> Create object Heroes on layer 1 (Heroes.X+60,Heroes.Y)
system -> Create object Heroes on layer 1 (Heroes.X+60,Heroes.Y)

= The rest of the heroes are created randomly from the Heroes family with a dynamic position referred from the latest instance of Heroes. I only created three, but the principle should work with, for example, a For loop.

Just set the first instance of family somewhere and loop the rest.



B
5
S
1
Posts: 18
Reputation: 436

Post » Sat Feb 02, 2013 9:58 pm

@Tumba - thanks for the reply!

i have solved it using UID's and families, sticking the platform creation under one event and adding two events with a "checker" variable to set to 1 or 0 depending on what is touching the sensor. woohoo!
B
14
S
6
G
2
Posts: 136
Reputation: 3,210


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 16 guests