[SOLVED] Creating/spawning objects through script

This forum is currently in read-only mode.
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • I can't seem to create or spawn objects by using a script, say:

    System.Create(Sprite,1,100,100)[/code:j289hzd6]
    
    Doesn't seem to do anything. Am I doing something wrong?  
    
    [i]Edit: I'm stupid. Quotation marks![/i]
  • While this remains unresolved, I've found an alternative:

    Using the Function Object, create a function "Create Object" with the following action:

    System > Create Object by Name (Function.Param(1)) on layer (Function.Param(2)) at X (Function.Param(3)) and Y (Function.Param(4))

    Then I use the following script to create the object:

    Function.AddParam("Text")
    Function.AddParam("Main")
    Function.AddParam(System.MouseX)
    Function.AddParam(System.MouseY)
    Function.Call("CreateObject",0)
    Function.ClearParams[/code:ey2068uy]
    
    However, I'd like to be able to create objects directly through Python script. This is bit of a roundabout solution...
  • here's how to make it work:

    System.Create("Sprite",1,100,100)[/code:250y764g]
    Notice the quotes.
  • Hmm, then what is the difference from System.CreateByName?

  • In python no difference whatsoever, they both use the same action.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I see, thanks. At first it didn't work within quotes, but I've must made a subtle typo then.

    Disregard this thread, I'm stupid.

  • I see, thanks. At first it didn't work within quotes, but I've must made a subtle typo then.

    Disregard this thread, I'm stupid.

    Veteran bugfinder's are never stupid. They are just so busy with important things that miss something small

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