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

This forum is currently in read-only mode.
From the Asset Store
Various Bell Sounds (from small to huge) / 35 Unique Clips / 2:46 minutes of audio
  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • the info structure of CRunObject (most of the sdk is defining this object, your plugin itself)does everything you need for movement

    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]
  • wonderful! I will give it a try and will let you guys know.

    cheers!

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