I spent the last couple of days reading over the Owyl docs, and I’ve managed to implement some basic AI in Gun Bastard.
I’ve got two different follow behaviours for the bad guys, a “shoot object x if you can see it”, and I’ve farmed the player controls out to joystick move and fire behaviours rather than them being in the game loop.
My player control code now looks like:
repeatAlways( parallel( limit(behaviour.joystickFire(ship, list=World.mybullets, stick = stick), limit_period=.1) , repeatAlways(behaviour.joystickSteer(ship, stick = stick)) ,policy=PARALLEL_SUCCESS.REQUIRE_ALL ) )
I’m writing all my behaviours to work against my standard sprite objects, so I should be able to reuse the routines as I add new enemy types by just adding existing behaviours to them- way less ugly than some of the Sheep Snaggers code. :D