Fangames > Programming Questions
help with traps
Raganoxer:
trying to code traps on yuutu engine to follow a path and cannot get them to work, i created the path to follow and all but it either A. refuses to move OR B. just moved one direction. What is the coding to make a spike follow a path?
lawatson:
It depends on which engine you use, but here's a reliable trigger code.
(click to show/hide)if (!global.trigger[trg]) {
global.trigger[trg] = true;
}
Put this code in your playerKiller object step event (in the parent folder)
(click to show/hide)//Path trigger
if t = 1{
if (path_index != pth){
if (global.trigger[trg]){
path_start(pth,spd,enda,abso)
}}}
In the playerKiller End of Path event, put this.
(click to show/hide)if t = 1 and loop = 0 and spd != 0{
spd = 0
path_end()}
If you want to make something follow different paths for multiple triggers, you can either learn to create a more complex trigger system or create a single object which has multiple actions for each trigger.
Raganoxer:
--- Quote from: lawatson on January 04, 2015, 01:12:49 AM ---It depends on which engine you use, but here's a reliable trigger code.
(click to show/hide)if (!global.trigger[trg]) {
global.trigger[trg] = true;
}
Put this code in your playerKiller object step event (in the parent folder)
(click to show/hide)//Path trigger
if t = 1{
if (path_index != pth){
if (global.trigger[trg]){
path_start(pth,spd,enda,abso)
}}}
In the playerKiller End of Path event, put this.
(click to show/hide)if t = 1 and loop = 0 and spd != 0{
spd = 0
path_end()}
If you want to make something follow different paths for multiple triggers, you can either learn to create a more complex trigger system or create a single object which has multiple actions for each trigger.
--- End quote ---
I literally had no idea what you just said, only the parent function for player killer. I made a path for the spike to follow and set up the spike sorta like this
trg=7
t = 1
pth = path21
spd = 6
yet it never works, what am i doing wrong? i am using the yuutu engine
heres what i put listening to your instructions -> https://puu.sh/e4AIp/ddc8a95622.png
lawatson:
Put a trigger down and in its creation code type
tid=#(whatever number)
In the trap spike, put
tid=same #(so it activates when a tid of that id is true)
t=1(trigger action, which is path)
pth=path index
spd=number
enda and abso can be left empty.
Raganoxer:
--- Quote from: lawatson on January 05, 2015, 06:57:10 AM ---Put a trigger down and in its creation code type
tid=#(whatever number)
In the trap spike, put
tid=same #(so it activates when a tid of that id is true)
t=1(trigger action, which is path)
pth=path index
spd=number
enda and abso can be left empty.
--- End quote ---
lol.. i think im ready to give up. ive been playing with this for 3 days now and i cannot, under any circumstances, get this to work.
could there be anything else i am possibly missing to have it not be working?
trigger also contains trg and tid with the same numbers as the spike -> https://puu.sh/eblE5/8575d20dc9.png
im just trying to have it move left and stop, but it either continues to move, or just doesnt move at all.
Navigation
[0] Message Index
[#] Next page
Go to full version