Can't spawn objects on the game

  • tarek2 Hey dude, I'm having kind of a hard time on the reference thing. Do you suggest referencing the specific instances using UID, IID...?

  • tarek2 Hey dude, I'm having kind of a hard time on the reference thing. Do you suggest referencing the specific instances using UID, IID...?

    you could do by "UID" all depends on your Logic but I don't think that you need the UID on this case you could just straight Pick the Object and then Spawn the PowerUp. There are many ways you could Pick the Pillar, as an example why not go for the most simple one "Pick The Nearest" I see from the Picture that You have only Two Pillar on the screen I guess 3 Max that could be at the same Time on the Screen so pick nearest it should work just fine.

    Now I don't know what its the Logic or rules you set up to spawn the PowerUp but I would probably Pick the Farthest Pillar to the Right so it gives Time to the Player to sees it in advance and therefore tries to think ahead to pick it Up.

    So the Picking will be simple just by filtering the PillarUp that are on the Screen or you could do the opposite if you like to spawn without the Player see it.

    Now To use "Pick the Nearest" you need to give coordinates (X,Y) you could use the edge of the Window screen With as an example say you have screen Window Size of

    With = 854

    Height = 480

    so the edge farthest distance to the Right it should be 854 so you could do now the Picking

    Every X Secs

    Sub>>>PillarUp Is on The Screen

    Sub>>>>PillarUp Pick The Nearest To : (X =854 , Y=0):>>>>>>>>Action Create PowerUp at (PillarUp.X, PillarUp.Y+(Your Amount)

    to make it spawn between the Pillars (top, bottom)

    Also instead to make a calculation for the Y Position you could just create a second "Image Point" on the PillarUp at the exact position where you wanna spawn the Powerup and just reference to the Image Point like this

    Every X Secs

    Sub>>>PillarUp Is on The Screen

    Sub>>>>PillarUp Pick The Nearest To : (X =854 , Y=0):>>>>>Action Create PowerUp at (PillarUp.X, PillarUp.ImagePointY(1))

    This is just one of many possibilities you could do, but I recommend you experiment with many and choose the easier for you if you have any question you can always ask

    I made a Demo for you, it's a C2 Capx but you can open it on C3

    https://www.dropbox.com/s/5enfscmchgjk22b/Flappy%20Bird.capx?dl=0

    .

  • easier to spawn the object would be when the pillars are spawn, bottom and top pick one of them if they are different like if u have a individual top pillar and a individual bottom pillar u can say when bottom pillar is spawning > create coin at bottom_pillar.bboxtop - (coin.height+coin.height/2) but that is if u have a pillar different then other named different, if not im guessing u are using a hidden spawning object with a sine outside right ? that spawns the pillars at some image points? then u can simply say spawn coin at spawner.origin point 0 or the image point that is in the middle of it.

    it all depends on how u made the creation of the things.

    here is a c3 example u can open it with the free edition, the code works with C2 as well.

    flappybird_logic.c3p

    to be noted... that type of gameplay is just "level 1 of flappy birds" or under score 50... original one once u passed score 50 different pipeline patterns come like slanted, moving up and down making the game 1000 times more difficult then this basic movement.

  • tarek2 You guys are amazing! I'm gonna try and do it. If I'm successful I'll post here xD

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • OMG it was like the easiest thing ever! It totally worked! I just set the following events:

    Thanks everyone who posted here, I think I used all the tips xD

    Yay I'm so happy right now hahahaha

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