Spawn another object

0 favourites
  • 9 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hello.

    I have to sprites with bullet behaivor, which moving to each other.

    (sprite1) ->

                                        <-(sprite2)

    When sprite1.x equal to sprite2.x i must spawn sprite3.

    But have no new object. Can you tell me why? Bug?

    dl.dropbox.com/u/58705288/test.capx

    Thnx in advance.

  • Equal is a little bit risky to use.

    Perhaps this capx is will help you?

    CAPX

  • Thanks TastyBytes.

    But, question still actual.

    Just imagine:

    Sprite1 is a bomber and Sprite2 is a vechile and Sprite3 is a bomb.Destroying of these objects is not correct when condition Sprite1.X < Sprite2.X

    I see only one way to make it correct with "Sprite1.X < Sprite2.X" - we must insert instant variable "Bomb_count = 1" to bomber. But this way is so bulky.

    Any ideas?

  • Well i spent some time trying to figure out how to fix it and couldn't come up with any good ways to use the "Compare X" that you used. An alternative if you can't figure out the "Compare X" is "if Sprite is overlapping Sprite2". But then you will have to have them collide of course.

  • omgitburns thanks

    Your way have another problem.

    Gamezone is 400x400, Sprite1 moving on y=100 and Sprite2 moving on y=300, size of both sprites is 30x30 and they never collide ;(

    We can make sprites with size 30x400, but it`ll be perversion ;)))))))

  • A capx

    Tastybytes is right about the fact that "the same X for both sprites" is likely to not happen at all.

    Check for an "area".

    In the capx I make sure both sprites are in 10 pixels range of each other, this seems to do the trick when they "cross".

  • Objects don't move smoothly, they actually move in little jumps every frame. Also, one object can be at X = 100, and another can be at X = 100.000000001, and those are not equal, so the chances the event is true is almost impossible.

    You probably want an event something like

    + Sprite2.X < Sprite1.X ("sprite2 is to left of sprite1")

    + Trigger once ("only do this once")

    -> Spawn sprite3

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks to All.

    Ashley, i did this thing:

    Every tick i compared to variables floor(Sprite1.X) and floor(Sprite2.X) - have no result or "floor" did not work here too?

  • It will make integers out of your coordinates, so it works.

    But with two objects moving at fixed interval of distance (each tick they move by X pixels), starting on "random" position, what are the odds that both objects ends up exactly at the VERY SAME X during their course ?

    Answer: close to none.

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