Creating random objects from a set ?

Get help using Construct 2

Post » Sun Feb 02, 2014 8:08 am

I want to create random objects in an infinite runner platformer. The objects are tiled backgrounds and I need to create 1 out of them randomly each time.

Here's How I am doing it for 1 Object currently :




I tried using Object families, but couldn't get it to work. I created a family "Blocks" and put all my tiled Bg Objects that I wanted to choose randomly from,in it. Then I replaced the "Block" object with "Blocks" family object (in the pic that I showed above). But, that doesn't create any object at all, on the screen. As far as I read somewhere, It should randomly choose and create one object from the family.

I've tried giving the same behaviors to the family as those of its objects (bullet, solid)


Is there any other way to get it to work ? Am I missing something ?garish2014-02-02 13:57:17
B
5
Posts: 16
Reputation: 261

Post » Sun Feb 02, 2014 8:24 am

I might have this totally wrong - in which case I apologise.

Judging by the lack of a medal in your avatar I think you must be using the free version ? I don't think that families work in the free version.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Sun Feb 02, 2014 8:34 am

I'm creating it for a friend of mine who has the paid version.
B
5
Posts: 16
Reputation: 261

Post » Sun Feb 02, 2014 10:18 am

I've created an event like this:
every 2 seconds:
destroy blocks (family)
system create blocks (family) on layer ...

And it worked without problem. So maybe you missed to exchange one vital block expression with, at least would be my best guess now.


[QUOTE=RamPackWobble] I might have this totally wrong - in which case I apologise.

Judging by the lack of a medal in your avatar I think you must be using the free version ? I don't think that families work in the free version. [/QUOTE]
Steam users for example don't get the badge, so you can't really be sure if the persons own the personal version either way.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Sun Feb 02, 2014 10:38 am

[QUOTE=mindfaQ]
Steam users for example don't get the badge, so you can't really be sure if the persons own the personal version either way.[/QUOTE]

Thank you - I didn't know that.

Perhaps it would be a good idea to give Steam purchasers a medal to save this potentially embarrassing situation?


August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Sun Feb 02, 2014 1:51 pm

[QUOTE=mindfaQ] I've created an event like this:
every 2 seconds:
destroy blocks (family)
system create blocks (family) on layer ...

And it worked without problem. So maybe you missed to exchange one vital block expression with, at least would be my best guess now.[/QUOTE]

I couldn't get how would that work ?

You meant like this ? :




It's not working..garish2014-02-02 13:58:10
B
5
Posts: 16
Reputation: 261

Post » Sun Feb 02, 2014 3:14 pm

Why don't you use array and/or dictionnaries. And define for each key (s) the behaviours.
B
8
S
2
Posts: 35
Reputation: 838

Post » Sun Feb 02, 2014 5:20 pm

[QUOTE=Teclis01] Why don't you use array and/or dictionnaries. And define for each key (s) the behaviours.[/QUOTE]

Can you shed some light on how could I achieve the object randomness through arrays/dictionaries ? An example or something..

I tried doing a new way out:



But it failed too. The block2 gets created in air..
B
5
Posts: 16
Reputation: 261

Post » Mon Feb 03, 2014 12:02 pm

Here's a sample project where I tried to use the family concept but wasn't able to achieve it:

https://dl.dropboxusercontent.com/u/16564767/runner.capx

Any help would be appreciated..
B
5
Posts: 16
Reputation: 261

Post » Wed Feb 05, 2014 6:19 pm

Is there no way out ?
B
5
Posts: 16
Reputation: 261

Next

Return to How do I....?

Who is online

Users browsing this forum: koops and 8 guests