• 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!

Small object changes after going to room 2nd time,.

GoliBroda

Member
Hi all.
In my game there are gold coins and purple coins.
1 purple coin is 100 gold coins.
And you can play selected level how many times you want.
Mostly you can find gold coins but rarly can find one or two hidden purple coins.

Now what i want to do?
If you play the level and take the purple coin then die or complete the level and try to play again the same level i want to dissapear the collected coin or turn it to gold coin.
But if there lets say 3 purple coins in room and you collect only one i want the not collected coins to do not dissapear.
 
T

Treecase86

Guest
Hi all.
In my game there are gold coins and purple coins.
1 purple coin is 100 gold coins.
And you can play selected level how many times you want.
Mostly you can find gold coins but rarly can find one or two hidden purple coins.

Now what i want to do?
If you play the level and take the purple coin then die or complete the level and try to play again the same level i want to dissapear the collected coin or turn it to gold coin.
But if there lets say 3 purple coins in room and you collect only one i want the not collected coins to do not dissapear.
This is quite simple.
Code:
///Purple coin object

//create event
global.coincollected = false;            //This sets up the coin as not collected

//step event
if (place_meeting(x, y, objtest)) {        //this makes the coin check if its collided with the player
    global.heartcollide = true;
}
else
    global.heartcollide = false;

if (global.heartcollide == true) {        //this destroys the coin if collected
    instance_destroy();
}
 

GoliBroda

Member
I think it is not what i meant.
You just gave me code to destroy coin after collide with it.
Didnt tested it yet but after reading im not sure about it.
also there is not even global.coincollected changing to true
 
T

Treecase86

Guest
I think it is not what i meant.
You just gave me code to destroy coin after collide with it.
Didnt tested it yet but after reading im not sure about it.
also there is not even global.coincollected changing to true
I don't really understand what you want. Could you try and explain it a bit better?
 

GoliBroda

Member
I got a room. You can go to this room how many times you want to farm loot from monsters or chests.
But i dont want player to farm the coins. So you go to room for the first time and collect few coins then exit from the room.
Now when the player will return to this room all of collected coins will appear again. And i dont want this.
If player return to that room i want to collected coins not appear and non collected stay there untill player will collect them.
I cant to tell it simplier.
 
Last edited:
Top