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

Peranah plant problem


Appo

Recommended Posts

Hey, since the click team forum has let me down i thought i would seek help from the skilled people here. I'm creating a mario type game with the sonic worlds engine and have come accross a problem. I have made a peranah plant movement which works untill mario gets close to one, like in the mario games when he gets close to one it won't pop up but this causes a problem for any that arn't near mario they just keep floating up, i've attatched an MFA file to show what i mean. Just move the mouse close to one and you should see what i mean. I know i could probably use the 'path' movement but that would require a lot of code chage as there are other events involving the plants but i'm just having trouble with the movement.

Can anybody help me in correcting this please?

Application.mfa

Link to comment
Share on other sites

Gah I thought I could just hop right into the code but it's just not straight-forward enough in design for me to be able to figure out right now. =/ But uh, maybe you can try doing a distance calculation between the plant and mario in one of the plant's alterable values, and then compare that value to a certain range to determine if you're close enough or not to affect the plant.

  • Like 1
Link to comment
Share on other sites

Create an invisible object (call it proximity detector) that is wider than the pipe. Put one on top of every pipe in your game (where mario will come in contact) Make it look like a big rectangle, when mario collides with the proximity detector it will then start the movement event. If he is not colliding with it the plant will remain static. It will look like this:

Objects:________________________________________Piranah Plant

EVENT 41: mario is overlapping Proximity Detector______Start movement

(duplicate and Negate the event)

EVENT 42: X mario is overlapping Proximity Detector____Stop

EDIT------> I just looked at your .mfa and I see something else. First of all you have a lot of events going on just to make this one simple movement trick. You want to reduce your number of events in MMF as much as possible to maintain stability. It's over complicated. If you start over and use the method I described above (using a path movement wouldn't be bad either) I think it will work out a little better for you. You can make proximity detectors specific to the pipe and plant that you want to affect. It doesn't have to be so hard, just think about what I'm suggesting before you dismiss it. I'm trying to help you out.

  • Like 1
Link to comment
Share on other sites

Actually, the Mario proximity stuff should only affect the piranha plants that go out of the pipes upwards anyway. So for those ones it's as simple as adding the following check:

(Piranha XPos - Mario XPos)^2 < 25^2 (basically square the distance value you want to check for)

When this is true and if the piranha plant is in the resting state, don't allow the piranha plant to re-enter the exiting stage. I'd really recommend you do it that way since a single comparison and a power of 2 are much cheaper than a collision detection and you won't have to rely on some stupid object covering up every one of your most common type of piranha plant.

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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