This case was about creating an enemy that had some sort of AI. I created my enemy as a Bean Worker, as it would seem fitting to my gamestory. I created three different animations for him: Walkcycle, hitcycle and death.
The Beanworker was supposed to have enough AI to follow my character and hit him when my main character got too close. I did this by creating a new actionscript file containing information about the Beans walk direction to my main character. The speed and gravity on the Bean Worker was also added in this new actionscript file. I then named the .as file the same name as my exportname of my beanworker (BeanWorker), and when I import my character in my main actionscript file, it will also run this 2nd actionscript file.
I also got it playing the hitanimation by writing a hitTestObject. command. Now when my main character touches the enemy, my character will begin his hit-cycle.
The problems I detected was to activate my new actionscript file (BeanWorker.as) with my main file. I did not know that they had to have same name. After I found that out, I could begin clean my main actionscript file by cutting out coding of the beanworker to the new actionscript file.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment