C
Catherine Higgins
Guest
I want to design a game where if you pick up a magic mushroom you can go through walls that you weren't able to before. Pretty much remove their collision event. I need help on what to do.
Thanks,
Thanks,
obj_wall.solid_with_player = 1; // By default, 1 means you collide with walls.
// This is written in GMS2 format.
#macro MAGIC_MUSHROOM_ITEM 1
/// scr_magic_abilities(item, target);
scr_magic_abilities(argument[0], argument[1]);
scr_magix_abilities(MAGIC_MUSHROOM_ITEM, obj_wall);
item = argument[0];
mytarget = argument[1];
switch(argument[0])
{
case MAGIC_MUSHROOM_ITEM:
// If statement that checks to see if you have a magic mushroom or not.
// May need to make an array or list of all your current items and add the magic mushroom to that list in here.
// If so, then...
obj_wall.solid_with_player = 0; // Player does not collide with walls
// else
obj_wall.solid_with_player = 1; // Player will collide.
//
break;
}
if (magic_mushroom == true) {
//No collision code
}
else {
//Collision code
}
Much easier way:
When you collide with a mushroom, set a variable to true (i.e. magic_mushroom = true). Then have your collision code dependent on that variable.
And then use a timer to turn magic_mushroom to false after a certain period of time if you don't want it to last forever.Code:if (magic_mushroom == true) { //No collision code } else { //Collision code }