Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. void archerIA(mage_t *mage,archer_t *archer,queue_t *fireball){
  2.  
  3. if(archer->x > mage->x){
  4. archer->direction=-1;
  5. }else{
  6. archer->direction=1;
  7. }
  8.  
  9. if(archer->direction=-1){
  10. if(archer->x - mage->x < 400){
  11. archer->speed = 1;
  12. archer->direction=1;
  13. }else if(archer->x - mage->x > 650){
  14. archer->speed= 1;
  15. archer->direction = -1;
  16. }else{
  17. archer->speed = 0;
  18. archer->attack = 1;
  19. archer->frame = game_animation_frame(archer->startTime,5,1000,5);
  20. }
  21. }else{
  22. if(mage->x - archer->x < 400){
  23. archer->speed = -1;
  24. archer->direction= -1;
  25. }else if(mage->x - archer->x > 650){
  26. archer->speed = 1;
  27. archer->direction = 1;
  28. }else{
  29. archer->speed = 0;
  30. archer->attack = 1;
  31. archer->frame = game_animation_frame(archer->startTime,5,1000,5);
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement