Hi, folks. I've used Construct for a couple of one-month game jams in the past, and having come from a Click background taken quite nicely to it. It recently caught my eye when I arbitrarily decided I'd like to make some kind of game in Python -- to my surprise, Construct supported Python (2) scripting and for the most part, it's done exactly what I'd expect it to.
But I'm having trouble referencing an object just created in the same event. This seems like a very important thing to be able to do, since I'll want to create objects programmatically and change a bunch of their properties immediately.
I've got an http://s000.tinyupload.com/?file_id=00181508901184269694 which demonstrates what I'm trying. Basically, within an event I've got a script, and I'd like that script to create a Sprite object and then tell me how many sprites exist. The script has:
# Convenient random number generator
from random import randint
# Create a new Sprite object in a random position
System.Create("Sprite", 1, randint(640), randint(480))
# Count how many objects now exist
i = 0
for aSprite in Sprite:
i = i + 1
# Display how many objects were counted
System.MessageBox(i, "Count", 0, 0)
Running this, the for loop is always one object behind; it never includes the Sprite created earlier in the script. So my question is, within a single script sheet, how do I create an object and then immediately reference it?