Fangames > Programming Questions
help with traps
ethinthenougathorn:
i can recommend decompiling some fangames that use triggers.
thats what i did and my triggers were working perfectly as i wanted them to.
Raganoxer:
--- Quote from: ethinthenougathorn on January 07, 2015, 11:12:43 AM ---i can recommend decompiling some fangames that use triggers.
thats what i did and my triggers were working perfectly as i wanted them to.
--- End quote ---
lol trust me i have tried that with enjoy the game 1 and 2.. is there any fangame you can name that provides an easy understanding of traps with paths? (if you can ones that are preferably small)
FlyingTaoster:
One thing that really helped me understand how to do triggers was Lemon's Engine. He has code for the triggers and spikes that are rather easy to understand, so i'd suggest looking at that rather than hoping you can find a game to decompile.
Edit: Though it seems Lemon has taken his engine off the forum right now, so i don't know where you'd be able to get it
Raganoxer:
--- Quote from: FlyingTaoster on January 08, 2015, 12:41:06 AM ---One thing that really helped me understand how to do triggers was Lemon's Engine. He has code for the triggers and spikes that are rather easy to understand, so i'd suggest looking at that rather than hoping you can find a game to decompile.
Edit: Though it seems Lemon has taken his engine off the forum right now, so i don't know where you'd be able to get it
--- End quote ---
ohohoh trust me, i TRIED using that engine and they never work, could you explain? like whats the 31y negative thing? just list like basic coding to the traps and how to follow a path. whatever engine is easier ill go to it.
Stinkycheeseone890:
Here's how I do it.
collision with player event:
(click to show/hide)if idd=1{
with(playerKiller){if idd=1{vspeed=4}};
}
if idd=2{
with(playerKiller){if idd=2{hspeed=-1};if idd=3{hspeed=-3};}
}
instance_destroy();
...that's it! This way, all of the triggers you might have are the same object. You just have to assign them idd's, along with the spikes you want to move. Like this:
(click to show/hide)
Now I'll explain what I did there. I gave that trigger an idd of 1, via the creation code method shown in the picture above.
I ALSO gave the spikes above an idd of 1, but it DOESN'T have to be the same number as the trigger that makes them move!
The code above states, if the TRIGGERS idd is 1, then the "playerKillers" (spikes) with an idd of 1 will have a vspeed of 4 when the trigger its touched by the kid. Here it is in action: https://gyazo.com/bc3706b5ac9f7bdee01a039c02bc8be4
You see, I gave all 4 of those spikes the idd of 1, and when I hit the trigger with the idd of 1, they went down! Now, I did the same thing with the next bit of code there, except it's a TINY bit more complicated, but not really. It triggers two spikes in two different ways! It gives them two different speeds. I gave one an hspeed of -1, and the other an hspeed of -3, with the same trigger. They have different idds, but the trigger still activates both of them. It makes the spike with an idd of 2 (the top spike) move at a slower speed than the spike with an idd of 3 (the bottom spike.) Oh, and the next trigger has the idd of 2, so it can actually activate them! Here's how it looks: https://gyazo.com/2e539e00b36d4770c6a93ea087d5819c
Oh, and I destroy the instance so it can't do the actions more than once.
You can add anything you'd like to it, this is how I do it. Provides a lot of leniency!
...now that may seem complicated, but it really isn't, most of that was just me explaining how it worked, haha!
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version