Legacy GM jumpthrough blocks

phillipPbor

Member
spr_jumpups_0.png
jump through block
"its different. it may act like a jump_through block like any games, but if you swap the tinted colors then they do the opposite."

I was having trouble with it when came to researching shauns tutoriels, then I looked at other videos.
and having trouble, like I learned there is a bbox_bottom > bbox_up that dose solid = false into solid = true. but I get errors so I give up and need advice from all of you. do you know how to fix it?
 
M

Maximus

Guest
Placing something like this in the step event of the player will probably give the effect you described:

Code:
with (obj_jump_through_block)
{
    if (facing_up) 
    {
        solid = (bbox_top > other.bbox_bottom);
    }
    else 
    {
        solid = (bbox_bottom < other.bbox_top);
    }
}
 

phillipPbor

Member
Placing something like this in the step event of the player will probably give the effect you described:

Code:
with (obj_jump_through_block)
{
    if (facing_up)
    {
        solid = (bbox_top > other.bbox_bottom);
    }
    else
    {
        solid = (bbox_bottom < other.bbox_top);
    }
}
what is with the facing_up ver for? the up key?
 
M

Maximus

Guest
what is with the facing_up ver for? the up key?
but if you swap the tinted colors then they do the opposite
if facing up is true you can't fall through the block, if its false you can't jump through. Is that what you meant?

Edit: also, don't refer to variables as a 'var' as this means a local variable in the context of Gamemaker. facing_up is not a local variable but an instance variable. Because it holds a value that we need to keep track of from step to step, using a local variable (declaring with the keyword 'var') would not work as local variables are destroyed at the end of the scope they are declared in (the scope of local variables in Gamemaker is the event or script in which they where instantiated).
 
Last edited by a moderator:

phillipPbor

Member
if facing up is true you can't fall through the block, if its false you can't jump through. Is that what you meant?

Edit: also, don't refer to variables as a 'var' as this means a local variable in the context of Gamemaker. facing_up is not a local variable but an instance variable. Because it holds a value that we need to keep track of from step to step, using a local variable (declaring with the keyword 'var') would not work as local variables are destroyed at the end of the scope they are declared in (the scope of local variables in Gamemaker is the event or script in which they where instantiated).
well okay, but just n case if anyone are not understanding the concept of this game then I shell show you the example. this block as 2 colors merged into 1, (red and cyan) and you know the laws of the colors: the first primary colors are the opposite to the secondary colors. because both of them are equally different from each other. so if alpha color = red: then this block will be a jump through instead. but if the alpha color = cyan: then this block will change into a fall through trap.
and a definition to the phrase "fall-through" is when you fall through the platform, you wont able to jump through this platform, if you do, it will bounce you back to the ground.
sprite70_0.png
EDIT: (the first come you post: "if facing up is true you can't fall through the block, if its false you can't jump through. Is that what you meant?" then yes. yes I do.

sorry.. I get what you mean.
 
Last edited:
M

Maximus

Guest
so if alpha color = red: then this block will be a jump through instead. but if the alpha color = cyan: then this block will change into a fall through trap.
and a definition to the phrase "fall-through" is when you fall through the platform, you wont able to jump through this platform, if you do, it will bounce you back to the ground.
Okay, so in the context of your game, facing_up is true when the block is red and false when it's cyan.
 

phillipPbor

Member
Okay, so in the context of your game, facing_up is true when the block is red and false when it's cyan.
yah, that's right! but to prove that those blocks truly retract.
I made a code. if color_per.R=1

because that var is from a source of the power up of color swapping.

Code:
execute code:

R = 1;

Step Event:

execute code:

// When changing to red or cyan mode
if R= 1 //redmode
{
 instance_activate_object(obj_platform_red)
 instance_activate_object(per_red);
 {
 with (all)
 {
    image_blend = c_red;
 }
 instance_deactivate_object(obj_platform_cyan)
 instance_deactivate_object(per_cyan);
}
}
else
if R= 0 //bluemode
{
 instance_activate_object(obj_platform_cyan)
 instance_activate_object(per_cyan);
 {
 with (all)
 {
    image_blend = c_aqua;
 }
 instance_deactivate_object(obj_platform_red)
 instance_deactivate_object(per_red);
}
}

Key Press Event for <Shift> Key:

if R is equal to 0
      set variable R to 1
      create instance of object obj_static at position (0,0)
else
      if R is equal to 1
      set variable R to 0
      create instance of object obj_static at position (0,0)
this is information.
if you collect the power-up this will, automatically activate so that wy you can swapcolors.
 
M

Maximus

Guest
well I tried your code fomula... it didn't work. it just jump and fall through the platform. like its not even there
If it was blue then that was the desired effect you described. I tested it before posting. Does the same happen when it's red?
 

phillipPbor

Member
If it was blue then that was the desired effect you described. I tested it before posting. Does the same happen when it's red?
I tried the code but I did nothin.
I made a code
Code:
with (obj_jumpthrough_platforms)
{
    if color_per.R=0
    {
        solid = (bbox_top > other.bbox_bottom);
    }
    else
    {
        solid = (bbox_bottom < other.bbox_top);
    }
}
I tried the coor_per.R= but nothing work... :( it like it never exist ever...unless there is a parent prob? hmmm...
 
M

Maximus

Guest
How are you handling collisions? I assumed you were using the solid flag and in built movement functions. Are you checking collisions and moving manually?
 

phillipPbor

Member
How are you handling collisions? I assumed you were using the solid flag and in built movement functions. Are you checking collisions and moving manually?
no I don't now what they mean. also there is no facing_up in gm. is there a way to make that facing_up a real instance variable?
 
M

Maximus

Guest
by the looks of your code, it should work if replace facing_up with (image_blend == c_red)

Code:
with (obj_jumpthrough_platforms)
{
   if (image_blend == c_red)
    {
        solid = (bbox_top > other.bbox_bottom);
    }
    else
    {
        solid = (bbox_bottom < other.bbox_top);
    }
}
 

phillipPbor

Member
by the looks of your code, it should work if replace facing_up with (image_blend == c_red)

Code:
with (obj_jumpthrough_platforms)
{
   if (image_blend == c_red)
    {
        solid = (bbox_top > other.bbox_bottom);
    }
    else
    {
        solid = (bbox_bottom < other.bbox_top);
    }
}
yah and i leaned that the sprite mask needs works I fixed it... but as I run a game, no matter what I tried... it just ended up full solid or not solid. and the entire code formula are shauns. maybe there is something missing here?

(I thing remind you the platformer I get was shaun spalding's tutorial of platforming. but I cant get his jump through formula tutorial, that's not what I want)
 
Last edited:
Top