SpawnObject() vs. System.Create() in a Python script?

This forum is currently in read-only mode.
  • Is there any difference between these two functions? I can't even get SpawnObject to work at all in a script, though it works fine as an action in the event sheet. Am I correct that System.Create will produce instances of the object in question, still indexable as normal? Well, they are indexable, I just checked. I guess I wanted to make sure that if I create 400 copies of a sprite using System.Create, I am not wasting resources actually making new objects, they are for real just instances.

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Welcome to the forms. Both those functions are just wrappings of their event counterparts, which create new instances of the specified object. Are you getting the error "NameError: name 'SpawnObject' is not defined"? If so, then you're calling SpawnObject wrong.

    Examples of usage.

    System.Create('Sprite2', 1, Sprite.X, Sprite.Y)[/code:9dbub4pk]
    will do the same thing as
    [code:9dbub4pk]Sprite.SpawnObject('Sprite2', 1, 0)[/code:9dbub4pk]
    
    -cheers
  • Hey, thanks for the info and the welcome. It turns out I was failing to put the sprite name in single quotes when calling SpawnObject - an error I should have spotted since I was using quotes correctly with System.Create! But it's good to know that they are equivalent, that's what I was looking for, thanks!

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