MFGG Forums
Little help? - Printable Version

+- MFGG Forums (https://forums.mfgg.net)
+-- Forum: MFGG (https://forums.mfgg.net/forumdisplay.php?fid=4)
+--- Forum: Developer Discussion (https://forums.mfgg.net/forumdisplay.php?fid=10)
+--- Thread: Little help? (/showthread.php?tid=833)



Little help? - WWpl4y3r - 05-03-2018

So... I'm making a game on GM:Studio, and... Let's just skip to the point. I want to make an object, a training weight(one of those oversized, cartoonish ones) so that when they fall, if you stand in the middle of the weights, they'll do you no harm, but actually damage you if you're under either side. How do you edit the mask so that happens? Is it possible?


RE: Little help? - Pedigree - 05-03-2018

You could create invisible mask objects to handle the collisions separately like obj_weightcol_L and obj_weightcol_R and set their x and y accordingly in a Step event, perhaps.

The issue would be if you had more than one weight at a time on screen, though, and there's probably an easier way to handle this.


RE: Little help? - VinnyVideo - 05-03-2018

Pedigree's method would be a good way to do it. You could actually make it so you could place as many dumbbells in the room as needed.

Here's what I would do:
  • First, I would create a "bar" object. This is the object that you'd actually place in the room. It wouldn't have a collision event with the player.
  • I would also create a "weight" object. This is the object that would actually hurt the player, so you'd need to put something in the relevant collision events.
  • In the bar object's Create event, you'd create two weights. (This is the GM 8 syntax, but GM Studio 2's is pretty similar):

Code:
leftWeight = instance_create(x-32, y, obj_weight);
rightWeight = instance_create(x+32, y, obj_weight);

In the bar's Step event, you'd make sure that the leftWeight and rightWeight instances move at the same speed as the main object.

Does this make sense?


RE: Little help? - WWpl4y3r - 05-05-2018

Both ideas seem to be good to go. I'll try them out once the time comes 'round to do those weights.

About Pedigree's idea, well, I actually intended on having multiple weights at the same room.

And about Vinny's, guess I should make the handlebar and the weights have the same hitbox then, at least same-sized so the bar doesn't fall very far  from the middle of the group when they  hit the floor.

Thank you very, very much. You helped a lot, seriously. Other Big Brin


RE: Little help? - WWpl4y3r - 05-23-2018

I hate doubleposting, but... Another little doubt here.

Someone told me earlier I shouldn't use PRECISE masking for the player - For it would screw the base code entirely.

But how about, say... In Tetris-themed "wall" objects? Should I make it precise? Won't be for the player, but I feel like making it create multiple little block masks out of spite would be overreaching on this one.

And yes, it's for the same project, on a different level.


This forum uses Lukasz Tkacz MyBB addons.