I want to be able to push a box in my platform game. Currently I am using the PMO for my character and everything seems to be working fine. I need the box to have gravity, but nothing too fancy. I was wondering if there is an article or tutorial on how to produce the things I want? Any help is greatly appreciated.
Hello guys! I'm New! -- I've been new for a year now...haha
put another PMO and the object you want to push. Give it a name like Active 2. Set your char's name for example "Active".
Always>PMO2, set object to "Active 2"
PMO1, test for obstacle overlap
+Active collides with Active 2 >PMO1, object does overlap with an obstacle
PMO2, test for obstacle overlap
+Active 2 collides with the background >PMO2, object does overlap with an obstacle
Collision between Active and Active 2
+Active is facing right >PMO2, user is holding right key
Collision between Active and Active 2
+Active is facing left >PMO2, user is holding left key
Well, this should help you. Your Active 2 will move slowly, just increase the X Velocity for the PMO2 for moving the obstacle faster. If you want to make more objects, you will need more PMO's. A PMO per object.
Originally Posted by -Finn- hi well this is easy with PMO.
put another PMO and the object you want to push. Give it a name like Active 2. Set your char's name for example "Active".
Always>PMO2, set object to "Active 2"
PMO1, test for obstacle overlap
+Active collides with Active 2 >PMO1, object does overlap with an obstacle
PMO2, test for obstacle overlap
+Active 2 collides with the background >PMO2, object does overlap with an obstacle
Collision between Active and Active 2
+Active is facing right >PMO2, user is holding right key
Collision between Active and Active 2
+Active is facing left >PMO2, user is holding left key
Well, this should help you. Your Active 2 will move slowly, just increase the X Velocity for the PMO2 for moving the obstacle faster. If you want to make more objects, you will need more PMO's. A PMO per object.
That sounds like a solid plan. Though I am worried that using that method may cause slow down. That is if the PMO is memory intensive. Can somebody get back to me on that. But Optimumly I would like to have all my objects have gravity. Any tips on that?
Hello guys! I'm New! -- I've been new for a year now...haha
>.O There isn't a reason I could think of that would make PMO processor/memory intensive. Just test it. If not that, you can make simple gravity by setting the object's Y value to its Y value plus a value or counter when it's not overlapping a backdrop. (Or you could change the collision to be more accurate, whatever floats your boat) Then, while the object is not overlapping a backdrop, always add to that counter. You may want to have a limit though. Actually, people apparently use fast loops in their movements nowadays-- something I've never done before. So that may not be the best way.
If you need a simple fastloop-based gravity/movement engine that can apply to all objects, and you're using at least MMF 1.5, you could check out this:
I don't know if you're familiar with qualifiers, but I use 'em for pretty much everything.
This file is the above movement with the addition of two more qualifiers: Group.Traps, which makes an object into a solid obstacle, and Group.Player, which lets an object collide with said obstacles. This way, a box can become something solid, and everything else can collide against it.
It's a simple solution, and doesn't support things like rideable or moving platforms, stacking objects, or objects that can push you around. But if you copy the necessary chunk of code into a game, it'll work well enough.
I've also included a couple o' lines that let the player push the block objects.
Originally Posted by -Finn- hi well this is easy with PMO.
put another PMO and the object you want to push. Give it a name like Active 2. Set your char's name for example "Active".
Always>PMO2, set object to "Active 2"
PMO1, test for obstacle overlap
+Active collides with Active 2 >PMO1, object does overlap with an obstacle
PMO2, test for obstacle overlap
+Active 2 collides with the background >PMO2, object does overlap with an obstacle
Collision between Active and Active 2
+Active is facing right >PMO2, user is holding right key
Collision between Active and Active 2
+Active is facing left >PMO2, user is holding left key
Well, this should help you. Your Active 2 will move slowly, just increase the X Velocity for the PMO2 for moving the obstacle faster. If you want to make more objects, you will need more PMO's. A PMO per object.