echwa.blogg.se

Game maker 8 enemy ai game
Game maker 8 enemy ai game




game maker 8 enemy ai game game maker 8 enemy ai game

The first "%" doesn't turn negative values into positive values (e.g. % 360" means that any value above 360 is reduced by 360, so that 460 or 820 both become 100 and stuff like that. (So that anywhere from -22.5 to +22.5 degrees becomes 0 later, instead of anywhere from 0 to +45 degrees.)

game maker 8 enemy ai game

"direction + 22.5" is to offset the whole check by 22.5 degrees, so that it can move slightly off-centre but still get the proper sprite applied. Switch (((((direction + 22.5) % 360) + 360) % 360) div 45)In case that confuses you, let's break it down: I'm guessing that the Case is the degrees it should be moving in but, it isn't facing in the direction it should be moving in. I'm using the enemy object as a target so my goal is to hit it, thus why I need it to move randomly.Ĭase 0: sprite_index=sprite_Thunder_Viking_Running_Right break //Change these sprite names to the ones in your game!!!Ĭase 45: sprite_index=sprite_Thunder_Viking_Running_Up_Right break Ĭase 90: sprite_index=sprite_Thunder_Viking_Running_Up break Ĭase 135: sprite_index=sprite_Thunder_Viking_Running_Up_Left break Ĭase 180: sprite_index=sprite_Thunder_Viking_Running_Left break Ĭase 225: sprite_index=sprite_Thunder_Viking_Running_Down_Left break Ĭase 270: sprite_index=sprite_Thunder_Viking_Running_Down break Ĭase 315: sprite_index=sprite_Thunder_Viking_Running_Down_Right break I'm looking to have my enemy object moving randomly in 8 directions with it facing & moving in the same direction.






Game maker 8 enemy ai game