How do I 'click' objects together after spawning?

Get help using Construct 2

Post » Mon Jan 06, 2014 11:46 am

Hiya guys,

I'm trying to figure out how to randomly create scenery (houses) and click them together the moment they spawn. I've used code to do this but I want to demonstrate to users that this can be done entirely with drag and drop commands (using a spawn point or something similar). Here's the situation in a nutshell:

- Objects now appear with random intervals (every X seconds) and random appearance (from a pool of frames within the sprite). This makes it seem different houses are on the background all the time. Neat, but it could be better. I want the houses to be connected, forming a skyline. Two image points should do the job, i.e. clicking origin 0 of one object to origin 1 of the other.
- I am using a spawn point outside of the layout and have already tried to use two sprites that spawn each other in turn, which works yet feels like a lengthy ordeal (I did the same thing for wrapping a background, using two instances of the same object).
- I'd like to do this without code, as I am using it for educational purposes. The frames I'm using within the sprite are all different sizes, so connecting them with a ticker counting pixels is not an option.

Any tips?
B
3
Posts: 7
Reputation: 189

Post » Mon Jan 06, 2014 11:58 am

[QUOTE=OnlineMerijn] Hiya guys,
how to randomly create scenery (houses) and click them together the moment they spawn.
Any tips? [/QUOTE]

Iam still cant figure out what it mean..


sorry, because of lack of understanding.. :(

btw, can u bring sample capx here?
B
12
S
2
G
1
Posts: 25
Reputation: 986

Post » Mon Jan 06, 2014 1:05 pm

No sample capx yet, all theory for now. Imagine a sprite with ten frames (different houses). A spawn point outside of the screen sends it in, with bullet behavior and an angle set at 180 degrees. Say every three seconds, a new house spawns outside of the screen, with a certain distance. I'd like to remove that distance and have these sprites neatly 'click' together, like LEGO bricks.OnlineMerijn2014-01-06 13:05:42
B
3
Posts: 7
Reputation: 189

Post » Mon Jan 06, 2014 3:38 pm

If you go ahead with the method using the bullet behavior, you would simply have to stop the object once it collides with another house

so. each house would have a bullet behavior facing 180

house on collision with house -> set bullet speed to 0

as each house touches the one before it, it will stop sliding in.
B
87
S
44
G
16
Posts: 1,002
Reputation: 17,932

Post » Mon Jan 06, 2014 3:41 pm

why not set the origin on the left and add an imagepoint on the right and have sprite itself spawn the new sprite at imagepoint 1, then set the frame to random.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: fearfulelephants and 25 guests