Hi everyone. I'm new to the forum so.. hello! My name is Felipe and I use Construct for a while making my game experiments.
Anyway.. My real purpose of registering in the forum is to solve a annoying problem I've been having:
Although I know that there's a particle effect built-in in Construct, I'm trying to create my own Python-scripted one.
Here is the CParticle class:
ID = 0;
def __init__( self, nX, nY, nW, nH ):
CParticle.ID += 1;
self.ID = CParticle.ID;
self.nX = nX;
self.nY = nY;
self.nW = nW;
self.nH = nH;
def Create( self ):
System.CreateByName( "spr", 1, self.nX, self.nY );
spr[self.ID].Width = self.nW;
spr[self.ID].Height = self.nH;
And this is my second script that creates a CParticle instance:
particle = CParticle( 200, 200, 8, 8 );
My problem is that when I run the project, I get the following error message:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<string>", line 11, int __init__
File "<string>", line 15, in Create
File "<string>", line 482 in __getitem__
Okay, I see that the index in "spr[self.ID]" (suposed to be 1] doesn't exist, but the sprite is created on screen. I tried to replace self.ID for 1 (since there's already another instance before the creation) and I get the same error.
So, my question is: why Construct does not detect the new instance?