Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Right, so the bats run this bullet-firing code every so often.
- var loop,_i;
- for(loop=0; loop<360; loop+=45) //fire 8 bullets at 45 degree intervals
- {
- _i = instance_create(x, y, oEnemyBulletWiggle);
- _i.direction = loop + sin(degtorad(time)) * 45;
- }
- The bullets themselves (oEnemyBulletWiggle) run this every frame:
- time += 1;
- direction += cos(degtorad(time)) * amount;
- So the initial direction of the bullet is a function of sin(time) while the change in direction over time is a function of cos(time). With this system, each bullet fires just a little bit off course, in a systematic way, so as to prevent any "safe" spots.
Advertisement
Add Comment
Please, Sign In to add comment