Flappy bird clone - Pin object to created objects

Get help using Construct 2

Post » Mon Feb 01, 2016 5:41 pm

Message: SteveKane can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
I'm creating a game similar to flappy bird and i've changed the way the pipes are created (it's one sprite rather than 2) as i wanted to try something different with the pipes. Thing is that now, there is no gap for the bird to go through as the gap counts as part of the pipe sprite when the bird collides into it.

My thinking was to have another sprite (a 10x10 box shaped to the same size as the pipes for example) that would pin onto the pipe areas and if he bird collides with that box, then its game over and that way the gap will be there for the bird to go through.

Problem is that i can't get the black box to pin onto the pipes, so i can't get it to work. The pin object doesn't seem to work on an created object.

How do i get my box to pin on to the pipe at the same size, essentally overlapping the pipe with the black box ?

I've attached a capx of the flappy bird clone where i've changed the pipes and added the black box.

https://www.dropbox.com/s/vtjg7we16l5a1pq/flapping%20bird%20example.capx?dl=0

Any help would be appriciated, thanks.
B
4
S
2
Posts: 111
Reputation: 830

Post » Mon Feb 01, 2016 6:08 pm

Making it 1 sprite instead of two, so you have to pin 2 sprites to it..
Ah..
Sounds logical..
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

Post » Mon Feb 01, 2016 6:42 pm

Well the sprite i wanted to pin has been cloned so there's two of them, so it's not 2 sprites as you're thinking.

I did acknowledge that i changed it from 2 sprites to 1 and that i had my reasons for doing so. I wasn't doing it for memory issues or anything like that, so even if i had two sprites to pin on to one, it's not a big of a deal as your making it.

Like everyone, we all need help on occasions, so it's helpful to see a thinly veiled insult towards what i'm trying to do from an experienced member of such a helpful community.
B
4
S
2
Posts: 111
Reputation: 830

Post » Mon Feb 01, 2016 6:53 pm

Ok, so the answer you were waiting for:

I guess the pinning doesn't work, because you don't have any event/actions pinning the objects..

How do you get them to overlap on created?
Create the two instances of the collider-object at the same time you create the pipe, position them so they overlap at the right position and pin them.
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

Post » Tue Feb 02, 2016 1:50 pm

I have done that but it's not working correctly as the sprite doesn't pin on to the pipe correctly, it pins in the centre of the pipes rather than on top and bottom. This is the bit i'm having trouble with, getting the sprites in the correct position when created.
B
4
S
2
Posts: 111
Reputation: 830

Post » Tue Feb 02, 2016 3:30 pm

i believe you have to add persist so that they remember what settings you have given them.

just like when I created my MM clone. I had to add persist to the doors so they remembered if I had opened them or closed them every time I reloaded the layout.
B
29
S
13
G
10
Posts: 355
Reputation: 8,312

Post » Tue Feb 02, 2016 6:00 pm

-event
- create pipes at (x,y)
- create collisionsprite at pipes.x, pipes.y-offset
- create collisionsprite at pipes.x, pipes.y + offset

collisionsprite on created
collisionsprite is overlapping pipes
- system wait 0
- collisionsprite pin to pipes

Not sure if the wait 0 is nescessary, but pinning can have issues..

the offset is offcourse the amount the collisionsprites have to move up or down compared to the y position of the pipes-object
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

Post » Wed Feb 03, 2016 11:10 am

That seems to have worked. Thank you for your help :)
B
4
S
2
Posts: 111
Reputation: 830


Return to How do I....?

Who is online

Users browsing this forum: bikachu, GabrielBalas, LukeNecklace, SoldjahBoy, Zaksoid and 13 guests