r112/r113 Spawn new object does not select new obj

0 favourites
  • 4 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hi!

    Compare these two action sets:

    a) Repeat 2 {

          System.Create object (Sprite1) at (Sprite2.X,Sprite2.Y)

          Sprite1.Set Bullet angle of motion to (floor(rnd*360))

    }

    b)Repeat 2 {

          Sprite2.spawn object (Sprite1) at point (0)

          Sprite1.Set Bullet angle of motion to (floor(rnd*360))

    }

    While (a) makes 2 different copies of Sprite1 moving at different angles, (b) shows two ovelapped instances of Sprite1 moving at same angle (user sees only one).

    I guess "Sprite2.Spawn Sprite1" does not pick the new instance of Sprite1, while "System.Create Sprite1" does.

    This behaviour should be clarified in manual and in the User Interface Hints.

    (I've tested this with both r112 and r113).

  • rnd is not an existing system expression.

    The expression should be random(360) in your code.

    If you created a global variable rnd, I suspect the value would be 0 in your second example, and the result would end up being 0.

    See this example I just made in r113, all "Sprite2" instances have a random angle of motion meaning they got picked as expected.

  • The only case it wouldn't pick the new object is if you have Sprite1: Spawn Sprite1.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Closing, please see how to report bugs and attach a .capx reproducing the problem if you believe this is a bug. It's impossible for us to reproduce your events because you have not defined what "rnd" is, and it may be critically related to the issue.

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