Object Optimize

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

    My game has +100 objects the objects is the same sprite. I am making this game for mobile devices so such an object count like that can causing lag and fps drops.

    I want to create this objects when they are on screen. When they are off screen, they will be destroyed.

    I tried to do this with on-screen but it doesn't work, individually. And I have tried destroy them due to players.Y with object.UID, it takes lots of time but it works. However I can't create object using this way and even I create objects the UIDs will change then I can't destory them.

    Is there a way or plugin to create objects when they are on-screen and destory them when they are off-screen ?

    Thanks for taking time.

  • There's an Is On-Screen condition, just invert that.

  • EncryptedCow

    My objects are the same sprite so it won't work for me. When I said

    X is not on-screen -> Destroy

    It destroys all X not just off-screen ones.

  • You could try for each object destroy when invert on screen. I think for each picks them one by one.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Check their position in relation to viewports, and then destroy accordingly.

    For Each Object

        Object X < ViewportLeft -> Destroy object.

        Object X > ViewportRight -> Destroy object.

        Object Y < ViewportTop -> Destroy object.

        Object Y > ViewportBottom -> Destroy object.

  • Thanks for replies,

    Windwalker it destroys all object.

    Excal

    Object Y < ViewportTop -> Destroy object.

    It works but

    Object Y > ViewportBottom -> Destroy object.

    this destroys all objects. The layout size 320*6000.

  • EncryptedCow

    My objects are the same sprite so it won't work for me. When I said

    X is not on-screen -> Destroy

    It destroys all X not just off-screen ones.

    You have something wrong with your events then. Here is an example: Destroy object offscreen

  • vee41 thanks for the capx

    It seems I did something wrong

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