Plugin beginner <-> how do I get the object's properties

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Tue May 24, 2011 6:24 pm

Hi,
I'm quite experienced in C++, but quite a noob in construct. Last sunday I was trying to implement a grouping routine for objects of the same type. By grouping I mean:

- whenever a object of the same type collides, they should snap onto one another and behave as if they were one single body. As if I was adding Lego blocks together.

I read about all sort of hacks to get it working using families and other tricks, but they are just too cumbersome. Therefore, I would like to implement a behavioral plugin that implements this. I read this:

http://sourceforge.net/apps/mediawiki/c ... e_a_plugin

But I'm still baffled on how to access/modify object's properties in the way I just told you.

Any tips/reading material would be appreciated.

Cheers,
Draconar!
B
1
G
1
Posts: 9
Reputation: 443

Post » Tue May 24, 2011 8:43 pm

the info structure of CRunObject (most of the sdk is defining this object, your plugin itself)does everything you need for movement
[code:12vtw8fb]info.x=10;[/code:12vtw8fb]
will change the object's positions to x=10
there's angle, h for height, etc, etc. since you're using visual studio, it'll be easy to see all the properties of info and most are self-explanatory.
after changing the orientation, dimensions, or position of an object call
[code:12vtw8fb]UpdateBoundingBox();[/code:12vtw8fb]
to make the changes actually apply at runtime. if you forget this, collisions will be all messed up
if you're changing the object itself
just info.whatever will suffice
however
if you want to make it a behavior, at the beginning of main where it says
[code:12vtw8fb]#define IDE_FLAGS OF_NOCOMMONDEBUG[/code:12vtw8fb]
add |OF_MOVEMENTPLUGIN
so it says:
[code:12vtw8fb]#define IDE_FLAGS OF_NOCOMMONDEBUG |OF_MOVEMENTPLUGIN[/code:12vtw8fb]

and instead of just info.x
[code:12vtw8fb]you do pLink->info.x[/code:12vtw8fb]
pLink is a pointer to the object that the behavior is attached to




[edit:oops, it's already in the right forum]
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Tue May 24, 2011 8:58 pm

wonderful! I will give it a try and will let you guys know.

cheers!
B
1
G
1
Posts: 9
Reputation: 443


Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 0 guests