Help with Spawn and Destroy Objects - Faster Game on Mobile

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hey folks, I'm making a mobile game where the player is always walking on a long layout, 6000px X 293px, and it can only jump. I want to add obstacles but when I placed everything where I wanted to be at, it ran slow on mobile, and I understand this is because the system is loading everything at once...

    So what I cant figure out is how to spawn the obstacles, which are 3 different ones and they should appear on different positions of the layout...

    I tried to create an Object that when the player would colide with it, it would spawn the obstacle at a certain image point (in front of the player). This kinda works, but since the player can jump it would spawn the object on different areas where they shouldn't be...

    So I need help to set up an event where when the player touches this Object, it will spawn the obstacle always at the same height ahead of the player... even if it jumps...

    I also need help to set up an event where a family of objects will be destroyed after it passes the player, like 300px away to the left...

    I'm sure this should be simple, but I'm just kind of a noob

    Thank a lot for anyone who can guide me.

  • Hey mate,

    Are you using the auto-runner template? How does that run with your mobile without any changes made?

    What you want to do is, when the game first starts load all of your obstacles in and then delete them before the game starts moving (This loads them into memory and should help avoid jank on creation).

    Your family of obstacles can have an event where you 'compare the X' value in the condition. Is it less than your 'player sprite' minus 300? If so destroy it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi GenkiGenga I am not using an auto-runner template, I have set the level as I wanted, not creating "at random". It is going left on every tick (plataformer)

    I will try your solution for the "X comparison", thanks a lot

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