Keese move like they do in LTTP? How do they move? Is that just fly in circular motions randomly and periodically stop?
For circular motions, you could do plenty. Such as, pivot around a random point, or increase the direction a specific amount each step.
Something like that would be coded as
if floor(random(2))=0 //With an equally random chance
{
diradd=random(25)+5
if floor(random(2))=0 {diradd=-diradd} //Once again, with an equally random chance, we might go anti-clockwise
direction=point_direction(x,y,objLink.x, objLink.y) //Start facing the player (change to the right object name)
speed=random(5)+2 //Nicely random speed...
}
else //Otherwise stop
{
diradd=0
}
alarm[0]=random(30)+10 //Don't forget to reset the alarm so we can decide whether to move again later.
if diradd=0 //If we're still
{
speed=0
}
else
{
direction+=diradd
}
As you can see, when programming bad guys, we need to use a lot of randomness, as that's easier than giving them actual intelligence.
As for deku baba, I'm not quite sure what to do. Do you want it to wait a while, then rise, then shoot, then return, and wait again? How many sprites do you have? Would it face the player? Something like this might work:
phase=0 //Let's say, 0 is wait, 1 is rising, 2 is shooting, 3 is falling.
alarm[0]=1
switch (phase) {
case 0:
if point_distance(x,y,objLink.x,objLink.y)<100 //If they're close enough to start attacking
{
phase=1
sprite_index=spr_deku_rising; image_index=0; image_speed=0.5
alarm[0]=image_number/image_speed //return after one loop of animation
}
else alarm[0]=random(30)+10 //Keep waiting otherwise
break;
case 1:
image_speed=0
a=instance_create(x,y,objBullet); a.direction=point_direction(x,y,objLink.x,objLink.y); a.speed=5;
phase=2; alarm[0]=20; //Wait a short while
break;
case 2:
phase=3
sprite_index=spr_deku_falling; image_index=0; image_speed=0.5
alarm[0]=image_number/image_speed
break;
case 3:
image_speed=0
sprite_index=spr_deku_wait
phase=0;
alarm[0]=random(30)+10
break;
}
You might wanna keep hold of the direction its facing, and do a switch statement to select the right facing sprite ecah time it changes. Make an objBullet for it to fire of course.
That probably won't work as I didn't test it, but.... meh.