Help in my project (zAxis) GM: STUDIO

S

Shift360

Guest


Hey people! I have a problem :

As you can see in the video, im working in my game's mechanics, void death and other stuff, but the void is not working properly. The GREEN boxes represent the floor and the RED is the collision, but i want to fall behind the floor for give to it a false depth sensation. I think it would be easy if I remove the player's mask till its not touching the floor, but I dont know how to do that. Also I want various collision layers, so my player is blocked during a tumble, but again, I dont know how to do it. Thank you and sorry if I made mistakes with my english :D

PD: Im using place_meeting to check collisions and all of these things.
 
S

Shift360

Guest
Can you reword your question for me please?
Is this top down or is it a platformer?
It is a 3/4 camera game, like zelda, but the nearest example of game is Hyper Light Drifter, with a false 3D sensation and platforming. What I want to do is fall when touching the void, and I cant fall behind the floor. The piece of code:

//Void

if (!onGround) {
phy_position_y = obj_player.y + 4;
phy_position_x = obj_player.x + hspd;

}
 
Last edited by a moderator:

Yal

GMC Memer
GMC Elder
Change the depth variable to a number > 0, and you'll end up behind all other objects by default.
 
S

Shift360

Guest
The player doesnt fall because of this:
//Void

if (!onGround) {
phy_position_y = obj_player.y + 4;
phy_position_x = obj_player.x + hspd;

}

Because when it touches the floor it stops, thats why I thought disabling the collision mask while not touching floor would fix the problem. I know the root of the problem but I dont know how to fix it. Thank you. Sorry if Im not explaining myself correctly :|
 

dannerz

Member
put invisible walls around the floors. then with movement, you can use a step based system, where you move 1 to 8 pixels per step. Each time you move one pixel, check if there is or is not an invisible wall in front of you.
Wouldn't that work for an old zelda style game?
 
S

Shift360

Guest
put invisible walls around the floors. then with movement, you can use a step based system, where you move 1 to 8 pixels per step. Each time you move one pixel, check if there is or is not an invisible wall in front of you.
Wouldn't that work for an old zelda style game?
Thanks dannerz, but I think that's not what im trying to do. Check this
thats what I want.
 

dannerz

Member
oooh. well, that looks quite possible to do. Hard to explain.
the fall down system could go like this:
if FALL = 1 { if vspeed <5 vspeed += 0.2; }
If you touch the black pit object, you get FALL = 1 until you die or fall off of the screen.

meanwhile the walls in front of you, give those walls transprancy / alpha blending.
and the darker grey normal objects don't really need any explanation.

however i may have failed at explaining.
If I was at home i could create an example.
but im at dad's house with poor net connection.
 
R

Robert

Guest
Im not really following your problem either, but if you wanted to simply disable the mask you can try this. Create a new sprite at 1x1 and edit it's mask. Now im not sure if you can give no mask at all, but try making the mask regions all 0 and see if that works. If that successfully worked and you now have a sprite with no mask go to your player object or whatever the object you want to make have no mask. Find in the code where you want to turn off the mask and type this:

mask_index = your_sprite_name_here

This should make the object use the mask of whatever sprite you assign it to. Once your done and you want the regular mask back just run the same command but with your correct sprite.

When you say you want various collision layers, an object can only have 1 collision mask at a time. You can however, as mentioned above, change the mask index and then run a collision check with that mask index, however I would not suggest doing that as it probably ins't a very good way of doing whatever your trying to do.
 
S

Shift360

Guest
Im not really following your problem either, but if you wanted to simply disable the mask you can try this. Create a new sprite at 1x1 and edit it's mask. Now im not sure if you can give no mask at all, but try making the mask regions all 0 and see if that works. If that successfully worked and you now have a sprite with no mask go to your player object or whatever the object you want to make have no mask. Find in the code where you want to turn off the mask and type this:

mask_index = your_sprite_name_here

This should make the object use the mask of whatever sprite you assign it to. Once your done and you want the regular mask back just run the same command but with your correct sprite.

When you say you want various collision layers, an object can only have 1 collision mask at a time. You can however, as mentioned above, change the mask index and then run a collision check with that mask index, however I would not suggest doing that as it probably ins't a very good way of doing whatever your trying to do.
You know? Thats what i thought, but setting mask at x =0 y =0 it exists mask and it keeps doing the same thing its doing in the video, and as I saw you cant disable the mask :/
 
S

Shift360

Guest
oooh. well, that looks quite possible to do. Hard to explain.
the fall down system could go like this:
if FALL = 1 { if vspeed <5 vspeed += 0.2; }
If you touch the black pit object, you get FALL = 1 until you die or fall off of the screen.

meanwhile the walls in front of you, give those walls transprancy / alpha blending.
and the darker grey normal objects don't really need any explanation.

however i may have failed at explaining.
If I was at home i could create an example.
but im at dad's house with poor net connection.
I will try it in a second.
 
S

Shift360

Guest
oooh. well, that looks quite possible to do. Hard to explain.
the fall down system could go like this:
if FALL = 1 { if vspeed <5 vspeed += 0.2; }
If you touch the black pit object, you get FALL = 1 until you die or fall off of the screen.

meanwhile the walls in front of you, give those walls transprancy / alpha blending.
and the darker grey normal objects don't really need any explanation.

however i may have failed at explaining.
If I was at home i could create an example.
but im at dad's house with poor net connection.
It doesnt work, and I think it doesnt work because vspd is part of my movement, and I set the vspd of the room to 0. The nearest thing I tried and almost worked was the mask idea. And as I see you cant disable a mask :(
 
R

Robert

Guest
okay well you just need to simply test for something, as in you need to test if you are a solid, or if some variable is your "i can move through floors now" variable. Generally that is what solid is for, but if you can't use it in that way then just use some arbitrary value and then go to where you set your onGround variable and say something like if(mySolidVar == true) onGround = true; Then when you are falling you need to set the mySolidVar to false and when you are not falling and it's not set to false set it to true. I'm not sure why that wouldn't work unless I am missing something. If you just want to pass through the floors thats all you should need to do.

However, if you are using the built in collision event to set your onGround variable then I think it might automatically stop your player from moving even if the event doesn't have any code UNLESS the object is not set to solid.
 
S

Shift360

Guest
okay well you just need to simply test for something, as in you need to test if you are a solid, or if some variable is your "i can move through floors now" variable. Generally that is what solid is for, but if you can't use it in that way then just use some arbitrary value and then go to where you set your onGround variable and say something like if(mySolidVar == true) onGround = true; Then when you are falling you need to set the mySolidVar to false and when you are not falling and it's not set to false set it to true. I'm not sure why that wouldn't work unless I am missing something. If you just want to pass through the floors thats all you should need to do.

However, if you are using the built in collision event to set your onGround variable then I think it might automatically stop your player from moving even if the event doesn't have any code UNLESS the object is not set to solid.
For detecting if my object is touching floor im using place_meeting, and no, im not using solid on my objects because it gave me problems, and i read that using solid may give problems.
 

Attachments

S

Shift360

Guest
Done:

I didn't solve the entire concept, but its a great step for me, because I just started to learn how to program and im really satisfied. Thank you all and if someone wants to know how to do it just ask me
on Twitter or here :D
 
Top