Sprite.Overlaps usage in Python

For questions about using Classic.

Post » Wed Apr 20, 2011 7:16 am

I've run into some weirdness with python again, and I was hoping someone could give me a hand. I can't seem to actually get any results with Sprite.Overlaps() in python, even though the same operation works just fine in the event sheet.

I have a "Player" sprite with the platform behavior running around (well, sliding anyway) on top of a solid object and another, non-solid sprite that is intended to work as a trigger (currently named Sprite3). No matter where I go onscreen, Player.Overlaps(Sprite3) always returns false from my python script. Has anyone else had trouble with this?
B
1
G
1
Posts: 4
Reputation: 433

Post » Wed Apr 20, 2011 10:42 am

The correct syntax would be, Player.Overlaps("Sprite3"), but "Overlaps" will cause a crash when used in python because it's implementation requires it to be attached to an event.

A solution is to use Player.OverlapsOffset("Sprite3",0,0) instead.
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Wed Apr 20, 2011 10:19 pm

Great, thanks again! It seems like I'm in the minority for wanting to use python so much, so I definitely appreciate the quick, thorough answers.

Speaking of which, is there a place where python functions / parameters are documented? If not, I'm willing to update the wiki what I learn from my experiences.
B
1
G
1
Posts: 4
Reputation: 433


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests