09-02-2021, 10:46 PM
I'm sorry for asking, as I really want to contribute to my project, but maybe I can learn something from you guys. I made a retro Hammer Bro (The SMB1 NES version), as I plan to include nostalgia worlds in my games. However, they keep bumping into the bricks above them. they can jump onto them, however. Before trying the current method, I used some modified code from Gatete's Super Mario Bros. Engine. the issue with that was the bros. would sometimes step off of a brick and onto the air. And when I alter the code to make it similar to the SMB Engine's Code, When the bros. jump on top of the blocks, they don't wanna go back down.
Here's the code (It's actually what the Normal Hammer Bro, which I left untouched, Uses
///Jump
//Jump higher if a block is above
if collision_rectangle(bbox_left,bbox_top-40,bbox_right,bbox_top-40,obj_blockparent,0,0)
{
vspeed = -7
alarm[4] = 2
alarm[5] = 16
}
else
vspeed = -4
//Boost jump
y--
//Gravity
gravity = 0.25
//If a block is below, jump through it
if collision_rectangle(bbox_left,bbox_bottom+8,bbox_right,bbox_bottom+8,obj_blockparent,0,0)
{
alarm[4] = 28
alarm[5] = 45
}
//Jump again
alarm[1] = 150
and here are the Mask and Sprite Properties for the walking and throwing sprites:
https://drive.google.com/file/d/19VuspZS...sp=sharing
https://drive.google.com/file/d/176o4M3v...sp=sharing
https://drive.google.com/file/d/1Nxu5d7m...sp=sharing
https://drive.google.com/file/d/1-xfiGZf...sp=sharing
I'm upset that I asked MFGG for help because I want to show off some work that I did so I can slowly build a team, but I don't know much about GML, and I keep procrastinating when I should be taking my time to learn GML and start work on the crossovers I so desperately want to complete.
Here's the code (It's actually what the Normal Hammer Bro, which I left untouched, Uses
///Jump
//Jump higher if a block is above
if collision_rectangle(bbox_left,bbox_top-40,bbox_right,bbox_top-40,obj_blockparent,0,0)
{
vspeed = -7
alarm[4] = 2
alarm[5] = 16
}
else
vspeed = -4
//Boost jump
y--
//Gravity
gravity = 0.25
//If a block is below, jump through it
if collision_rectangle(bbox_left,bbox_bottom+8,bbox_right,bbox_bottom+8,obj_blockparent,0,0)
{
alarm[4] = 28
alarm[5] = 45
}
//Jump again
alarm[1] = 150
and here are the Mask and Sprite Properties for the walking and throwing sprites:
https://drive.google.com/file/d/19VuspZS...sp=sharing
https://drive.google.com/file/d/176o4M3v...sp=sharing
https://drive.google.com/file/d/1Nxu5d7m...sp=sharing
https://drive.google.com/file/d/1-xfiGZf...sp=sharing
I'm upset that I asked MFGG for help because I want to show off some work that I did so I can slowly build a team, but I don't know much about GML, and I keep procrastinating when I should be taking my time to learn GML and start work on the crossovers I so desperately want to complete.