Getting a sprite to appear at the position of another...

This forum is currently in read-only mode.
From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • In the test stuff I'm doing, I've got an invisible sprite marker called Start. On the start of the layout Construct is told to move a sprite to its X and Y position. However, this doesn't work. I suspect I'm doing something dumb but have no idea what. Can someone explain to me what I should do?

  • You should run the debugger and look at the sprIvoRobotnik object. You can see exactly what's happening. The minute you start the application, because it is created on the first layout and has a platform movement, it starts falling. Really really far, down and down, until it's also going really fast. So as soon as you get to your layout it's probably going fast enough to pass through stuff.

    Deactivate the platform movement on the first layout, then activate it on the layer where you can actually start controlling him.

    Secondly, and the debugger also shows this, sprIvoRobotnik is being positioned by the Start object left over from the first layout. Because it's global it still exists, and Start.X and Start.Y just so happens to refer to that one, off the bottom of the screen, instead of the second one you placed on the layout. To get around this, you can destroy the first start object on the first layout on start of layout, or simply delete it from the layout editor - it still exists on the other layout, so it won't destroy completely. However, since you're going to be adding more levels and positioning start markers differently on them, I would suspect you really dont want other start markers from other layouts hanging around, so don't make it global. That also fixes it, since non global objects are destroyed when you move away from the layout.

    Remember, if things are going wrong, get the debugger out!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for that one! Going to take a look at the Platform stuff Deadeye's done too - looks like a hitbox is a good idea.

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