Luke Pierson
Member
Hello! So I've been working on an enemy for my game that will run away from the player and then teleport back to the center of the map if they reach the end. The whole time, they shoot projectiles which must be dodged. (Think Wizrobes from Zelda)
The problem: I have it set to where if the object reaches the x and y of the level's wall, it'll change sprites to look like it's teleporting. Works fine. They appear at the center, buuuut the only problem is that I can't seem to make the animation end after the final frame and then change back into the sprite before. It's probably an easy fix. I'll just post my code for the teleportation and animations here. Any help is much appreciated
The teleportation code works fine, but may be related to the problem. This is a step event:
This is the animation end event (initially had it in step):
I've been stuck trying to figure this out for longer than I should be haha so I'm turning to the community once again!
The problem: I have it set to where if the object reaches the x and y of the level's wall, it'll change sprites to look like it's teleporting. Works fine. They appear at the center, buuuut the only problem is that I can't seem to make the animation end after the final frame and then change back into the sprite before. It's probably an easy fix. I'll just post my code for the teleportation and animations here. Any help is much appreciated
The teleportation code works fine, but may be related to the problem. This is a step event:
Code:
if position_meeting(Fence.x, Fence.y, Fence) {
sprite_index = spr_cleric_teleport;
}
if sprite_index = spr_cleric_teleport {
if image_index = 5 {
action_move_to(obj_teleport.x, obj_teleport.y);
}
}
Code:
if (sprite_index = spr_cleric_teleport) {
if (image_index=10) {
sprite_index = spr_cleric;
}
}