bsimser's Recent Forum Activity

  • Objects and instances are the same in Construct as in a programming language.When you add a sprite to a project you are adding a object type and one instance of the sprite to the layout. You can have as many sprite object types as you want but generally I find it easier to make the events for a lower amount of object types.

    So if I read this correctly, objects in Construct are not classes like in a programming language and Construct instances are not like programming objects? When I create an object (through the Spawn object) I'm always creating a new object with it's own set of instance properties? So every object just has a unique set of instance properties but otherwise is an object?

    The manual instances have the properties, the objects do not, but I don't see how you create an instance at runtime (there's no Create instance action in the System but there is a Create object).

    To summarize if I had say a sprite defined as Enemy and an instance variable of Health on the Enemy if I spawn 1000 objects it's the same memory footprint (1 byte [Health] X 1000 items) as 1000 instances of Enemy (regardless of how they were created)

    Thanks for the clarification.

  • Joannesalfa I agree the comparison might be moot. I just see everyone using the sprite object as their player for example and wonder about the whole object vs. instance. Again, it might be negligible with only a few objects but 1000s of instances vs. 1000s of objects? Maybe something there.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi guys,

    First post here as I'm going through the system and coming up with ideas, best practices, and generally getting my head around choices when building games. As I primarily come from a programming background I tend to lean towards that for approach. So this begs the question of objects vs. instances.

    Obviously if I have 100 enemies in the game I'm going to spawn an instance through the system. However what about the Player? In many tutorials people are just adding a sprite to the game, calling it player and putting it on the board. Even though I have one player in the entire game I wonder is it better to create an instance (so I set all my dynamic properties like health, etc.) instead of using the sprite object?

    I realize the name object and instance here are Construct terms and don't necessarily adhere to an object and instance in programming languages but just wondering what the best approach here is (and if there is a performance hit between the two).

    Thanks!

bsimser's avatar

bsimser

Member since 30 May, 2013

None one is following bsimser yet!

Connect with bsimser

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies