Fangames > Programming Questions
Help with secret items
(1/1)
Keykay:
Well I know how to make secret items, but does anyone know how I can make the spikes and savepoints disappear if you collect the item like in Kamilia 3? I only know how to make them disappear immediately, in Kamilia 3 they disappear slowly and that looks so cool D: Would be nice, if anyone could help me^^
YoSniper:
Maybe do something like this with the object that acts as the parent for spikes and fruit and such...
(As long as it doesn't overwrite an event of any sort.)
--- Code: ---Secret Item collision with Player:
with(spike_fruit_parent) {alarm[0] = 2;}
instance_destroy();
--- End code ---
The exact object names are probably different or need to be created.
--- Code: ---Alarm[0] Event of spike_fruit_parent:
image_alpha -= 0.05;
if image_alpha <= 0 {instance_destroy();}
else {alarm[0] = 2;}
--- End code ---
Something like that? You might have to tweak the timing a bit.
Keykay:
--- Quote from: YoSniper on January 12, 2015, 08:44:39 PM ---Maybe do something like this with the object that acts as the parent for spikes and fruit and such...
(As long as it doesn't overwrite an event of any sort.)
--- Code: ---Secret Item collision with Player:
with(spike_fruit_parent) {alarm[0] = 2;}
instance_destroy();
--- End code ---
The exact object names are probably different or need to be created.
--- Code: ---Alarm[0] Event of spike_fruit_parent:
image_alpha -= 0.05;
if image_alpha <= 0 {instance_destroy();}
else {alarm[0] = 2;}
--- End code ---
Something like that? You might have to tweak the timing a bit.
--- End quote ---
Wow, it worked! Thanks for your help, I really appreciate it :)
Keykay:
--- Quote from: YoSniper on January 12, 2015, 08:44:39 PM ---Maybe do something like this with the object that acts as the parent for spikes and fruit and such...
(As long as it doesn't overwrite an event of any sort.)
--- Code: ---Secret Item collision with Player:
with(spike_fruit_parent) {alarm[0] = 2;}
instance_destroy();
--- End code ---
The exact object names are probably different or need to be created.
--- Code: ---Alarm[0] Event of spike_fruit_parent:
image_alpha -= 0.05;
if image_alpha <= 0 {instance_destroy();}
else {alarm[0] = 2;}
--- End code ---
Something like that? You might have to tweak the timing a bit.
--- End quote ---
do you also know how this works when I want to let something appear after collecting the item, like a warp? :/
YoSniper:
--- Quote from: Keykay on January 12, 2015, 09:50:06 PM ---do you also know how this works when I want to let something appear after collecting the item, like a warp? :/
--- End quote ---
You can put something like this in the Destroy Event for the secret item:
--- Code: ---instance_create(?, ?, obj_warp);
--- End code ---
REMEMBER TO REPLACE THE QUESTION MARKS WITH ACTUAL VALUES!
I can't tell you the number of times I've given pseudo-code to people, and they just blindly copy and paste it, and then come back to me with "I got an error, unknown value '?'."
Navigation
[0] Message Index
Go to full version