Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Moar Construct Help (Functions n Families)


Recommended Posts

So im currently Porting my Tails Adventure 2 engine into construct, with pretty promising results. I've already improved the collisions to handle speeds upwards of even 2000 pixels per second (completeeeellllyyyyy redundant and possibly performance destroying, but the ability has applications) . I've already created masks with very decent collision and correct instancing (which gave me a shitload of mindfuck on MMF2, oh my god) also, with accurate movement and the ability to actually control the amount of framerate rape i get with a few tweaks.

However, i've come into one really stupid problem.

Construct has the ability to group objects into Families, with the ability to also assign private variables to the groups. But it seems like whenever it try to pass one of these variables into a function as a parameter, it instantly crashes when i try to run it.

Im currently trying to find out if it's something im doing (or didn't do, since this has happened before), but usually the program will either tell you or vaugely hint at whatever dumb mistake you made while it crashes, but it doesn't get that far.

The code goes something like this :

> Sensor collides with family(MovingPlatform)

>Add parameter (whatever)

>Add parameter (whatever)

>Call function (whatever)

It doesn't seem to matter what i do or what I ask for, but if the Parameter is a family specific value, it will instantly crash the layout when i try and run it.

I'd much rather use Attributes for this anyway, but you're not able to pass values around with Attributes, only run conditions with them.

Edit: Yeah, it crashes no matter what i try. Even if i dont bother to even call the function, it bugs out. Im guessing it's a compile error or something?

Edit: Okay scratch that, apparently it crashes if i try to access the variable at all. Changing it to a value is fine, but trying to retrieve that value crashes the program. Odd. For all the things i can do with this program that i couldn't in MMF2, if im going to have trouble with family P.variables, then this is going to be a rough ride.

Link to comment
Share on other sites

I don't know anything about Construct, but from general programming knowledge you can't directly access private variables (that's why they're private!). You have to make functions to get and/or set these values, like so...

//Getting MovingPlatform's X position

variable moveX = MovingPlatform.getX()

//Setting MovingPlatform's X position

MovingPlatform.setX(120)

Again, don't know if Construct works that way, but hopefully this helps.

Link to comment
Share on other sites

Oh hell sorry, i seemed to have fixed the issue.

Like i thought, it was just a construct bug. I completely deleted the family i was working with and made another, worked like a charm.

And nah, Private Variables are just "Alterable Values" from MMF.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...