Appo Posted September 13, 2010 Report Share Posted September 13, 2010 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 More sharing options...
USC Posted September 13, 2010 Report Share Posted September 13, 2010 I'm not entirely sure what you want; however, perhaps you should try measuring how close Mario is to the pipe, not the piranha plant itself (include a statement like <Pipe is Overlapping Piranha> so it only affects the specific piranha you're near). 1 Link to comment Share on other sites More sharing options...
Appo Posted September 13, 2010 Author Report Share Posted September 13, 2010 I'm not entirely sure what you want if you move the mouse close to one of the plant and leave it there when the plants move, you should see what i mean. I'll have ago at what you suggested and see what i can do, thanks Link to comment Share on other sites More sharing options...
LarkSS Posted September 13, 2010 Report Share Posted September 13, 2010 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. 1 Link to comment Share on other sites More sharing options...
Appo Posted September 14, 2010 Author Report Share Posted September 14, 2010 sorry it probably is abit over complicated, i might have ago at re-doing the movement and implementing whats been suggested when i have time Link to comment Share on other sites More sharing options...
Jeffrey_bones Posted September 19, 2010 Report Share Posted September 19, 2010 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. 1 Link to comment Share on other sites More sharing options...
DimensionWarped Posted September 19, 2010 Report Share Posted September 19, 2010 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. 1 Link to comment Share on other sites More sharing options...
Appo Posted September 19, 2010 Author Report Share Posted September 19, 2010 yeah it is a bit overly comlicated but i kept tweaking until i had something i thought worked, i didn't see any problem untill i started making a level. Anyways thanks for the help guys, rep up Link to comment Share on other sites More sharing options...
Recommended Posts