0 Favourites

Flappy bird clone - Pin object to created objects

  • 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.

    dropbox.com/s/vtjg7we16l5a1pq/flapping%20bird%20example.capx

    Any help would be appriciated, thanks.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Making it 1 sprite instead of two, so you have to pin 2 sprites to it..

    Ah..

    Sounds logical..

  • 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.

  • 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 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.

  • 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.

  • -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

  • That seems to have worked. Thank you for your help

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)