solid object - bug

0 favourites
  • 5 posts
From the Asset Store
Match same tiles with each other as fast as you can and earn more score during a limited time!
  • Hi All,

    I have been having na intermittently problem involving platform objects and solids on construct 2, it´s more likely to happen if the layout has just loaded.

    I have a platform object that goes to the left or right when the user touches the screen. I also have to solid objects that should stop this object from moving.

    The problem is that sometimes the platform object goes through the solid object.

    Do you guys have any idea what could be happening.

    I have already tried the invisible square behind the sprite and it didn't work.

    Kind Regards,

    Allan Lopes

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello Allan,

    This is probably happening because the Platform Object moves too fast and some times, between two ticks, it travels more than the width of the solid objects, so it never collides and it looks like it passes trough.

    This is most likely to happen on Firefox, because it has some terrible performance spikes lately, that seems to affect collision detection (among other things). Try previewing the layout in Chrome or NW.js, I believe that you'll get different, more as expected, results there.

    You could also try to slow down the platform speed a bit, or use the clamp expression to limit the Sprite's position on the X axis. The event for doing this should look like this:

    System|Every tick-----> s1 | Set X to clamp(self.X, "lowX", "highX")

    where "lowX" and "highX" should be the number values that define the furthest to the left/right that you want your Sprite to be able to move.

  • The answer is logical.

    Assuming 60FPS, if an object is set to 50000 px per second (which is ridiculous), then in one tick, the object can travel 50000/60 px per tick ( approx 833).

    Considering the object that it's meant to collide with is only 20px wide, it's pretty obvious that the chances of a collision are slim, as the speeding object will easily pass by the collision object.

    To put it another way: if you had a standard screen size of say 1024x768, then you have set an object to travel at roughly 50 times the screen width every second. I can't envisage there ever being a need for such a thing - it makes no sense.

    The answer is to reduce the speed, or increase the collision object, but at the speed you are currently using, I can't see that increasing the collision object being of much use.

  • Thankys eli0s and zenox98! I will try another way.

  • allanblopes , what is it that you are trying to do? What do you want to make? Perhaps there is a simple way to achieve it, if you tell us what you're after maybe we can help with a practical example.

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