Fangames > Programming Questions
Create Events not firing?
(1/1)
klazen108:
Hey Guys, I'm having a weird issue in my fangame... let me start off with my specs:
Seph Edition Engine
Game Maker 8.1
So I've got this one room with a bunch of trolls. When you trigger them all and exit the room (as intended), the game starts acting very strangely. I'm not sure exactly what's happening, but it's like the create events are no longer being fired. The player starts moving faster than intended (but the physics seem to still be accurate), and the troll spikes in the previous room are clearly visible. You can see what I mean in the spoiler below. Caution: This is for my contest fangame, so if you don't want spoilers, don't open this tag!
(click to show/hide)I have the troll spikes on layer -1000000, above everything, for development; in the create event I put them at layer 1000000, below everything, so you don't see them. However, it's like the code to hide them isn't being run!
I figured this might be a problem with my room transition code, since it was custom written. I've included it in the spoiler below if you want to look at it.
(click to show/hide)
--- Code: ---//Collision with player event
var changedRoom;
changedRoom=false;
with (player) {
if (x > room_width) {
x-=room_width;
room_goto(other.roomTo);
changedRoom=true;
}
else if (x < 0) {
x+=room_width
room_goto(other.roomTo);
changedRoom=true;
}
if (y > room_height) {
y-=room_height;
room_goto(other.roomTo);
changedRoom=true;
}
else if (y < 0) {
y+=room_height;
room_goto(other.roomTo);
changedRoom=true;
}
--- End code ---
Another strange occurrence is that this bug only happens in this exact room, and only when you exit it on the left for the first time. I cannot reproduce this bug by coming back here later. If it happens, F2 does not fix it; I have to close the game and reopen it, and then it works as intended for the rest of the game. Maybe it's an issue with my triggers? I've included the code for them as well in the spoiler below.
(click to show/hide)
--- Code: ---//create event
primed=true;
//step event
//dep is a value you can set; this trigger won't activate until the trigger with a value of dep is activated
if (dep!=0) {
primed=false;
if (objFreeTrigger.triggered == dep) {
primed=true;
dep=0;
}
}
//collision with player event
if (primed && objFreeTrigger.triggered!=trg) {
objFreeTrigger.triggered=trg;
}
--- End code ---
If you require any other information, or would like to look at the project itself, let me know and I would be happy to share. Thanks for taking the time to read!
infern0man1:
Is the room set to be persistent? If it is, that's the problem. That's usually what causes some teoubles for me.
klazen108:
Yeah, persistent objects can cause trouble too, but it turned out the issue this time was because of particle systems... apparently, even if you destroy them when you're done with them, they still can cause memory leaks. I was trying to make a new particle system on this screen's room start, and when it reached that line, it caused game maker to silently error out on the rest of the code in the room start & create events, causing all the symptoms I saw. That was really a weird one... lesson learned, avoid particle systems whenever possible :Kappa:
lemonxreaper:
avoid particle systems? but they are so beautiful :Kappa:
Navigation
[0] Message Index
Go to full version