• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM mighty switch force

phillipPbor

Member
you ever know mighty switch force refranchise? because when you switch the bocks switch places, but if you switch while standing in front of it. crash! your dead! so how do you make players react to those?


I mean (shuan.S) should have made that when making a switch force like game. its so hard to not to get attention.
 
Last edited:

TheouAegis

Member
When you change the state of the block, Loop through all of the blocks in the room and have them check if they are colliding with the player. It's not very complicated if you think about it.

if switch_button pressed {
with blocks {
color = !color
if color && place_meeting(x,y,player)
player.dead=true
}
}
 

phillipPbor

Member
When you change the state of the block, Loop through all of the blocks in the room and have them check if they are colliding with the player. It's not very complicated if you think about it.

if switch_button pressed {
with blocks {
color = !color
if color && place_meeting(x,y,player)
player.dead=true
}
}
I have the color_par
///colorswap
R = 1;
Code:
// When changing to red or cyan mode
if R= 1 //redmode
{

 instance_activate_object(obj_platform_red);
 instance_activate_object(per_red);
 instance_activate_object(obj_latter_red);
 {
 with (all)
 {
    image_blend = c_red;
 }
 instance_deactivate_object(obj_platform_cyan);
 instance_deactivate_object(per_cyan);
 instance_deactivate_object(obj_latter_cyan);
}

}
else
if R= 0 //bluemode
{
 instance_activate_object(obj_platform_cyan);
 instance_activate_object(per_cyan);
 instance_activate_object(obj_latter_cyan);
 {
 with (all)
 {
    image_blend = c_aqua;
 }
 instance_deactivate_object(obj_platform_red);
 instance_deactivate_object(per_red);
 instance_deactivate_object(obj_latter_red);
}
}
its what made the color switch.
 

TheouAegis

Member
Well even better then! Just use

with all
i f id!=other.id
if object_index != obj_player
if place meeting(x,y,obj_player) player_dead = true
 

phillipPbor

Member
Well even better then! Just use

with all
i f id!=other.id
if object_index != obj_player
if place meeting(x,y,obj_player) player_dead = true
where can I put them? cause this part, I tried step event on obj_platform, and I just die when I collide with a power_up, ladders, or anything that is not solid.
 
Last edited:

TheouAegis

Member
You put it in the code where you change the states of all the blocks when you press the button/key.

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

with all 
{
    if place_meeting(x,y, obj_player) 
    {
        player_dead = true;
    }
}

You have a lot misplaced brackets ( "{" ) in your code, so I removed them. Anyway, here's how your code would look. Just change the very last part that I added to work with your project.
 
Last edited:

phillipPbor

Member
You put it in the code where you change the states of all the blocks when you press the button/key.

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

with all
{
    if place_meeting(x,y, obj_player)
    {
        player_dead = true;
    }
}

You have a lot misplaced brackets ( "{" ) in your code, so I removed them. Anyway, here's how your code would look. Just change the very last part that I added to work with your project.
if I did this code to the colorpower_obj (color_par), as the room red, player died for collide with ladders, or shift for color swap
 

TheouAegis

Member
If obj_blocks is the parent of obj_platform_red and obj_platform_blue and whatever else.

I'll say it again: All you need to do is inside the code that toggles the state of the game world, have every block check if there's a collision with the player (or if you want enemies to also get affected, have them check for enemies too). It's a very simple concept. If a single place_meeting() call won't work for you, then use whatever will work for you.

You don't need Shaun to help you with this, just your own brain and the coding practices Shaun taught you in his tutorials.
 
Top