Ball movement & A.I
Author: | Kaine
|
Submitted: | 25th January, 2003
|
Views: | 5103
| Rated: |
|
|
This my first article so ummm yay!
Any way alot of people asked me how do I code A.I using ball movement,so here it is its simple real simple so um enjoy
First we just gonna do the basic movment (i.e move back and forth) only
first when u select tha movement make sure the randomizer and securty is all the way to the left this makes it so that it wont bounce off in other directions then what u select.
second,make a marker like an arrow pointing left and on pointing right now heres da events. * this is for actions and - for events so lets start!
-enemy overlaps left marker
*set direction to 0 (wich is right)
-enemy overlaps right marker
*set direction to 16 (wich is left)
now thats for platforms heres is sonthing u can do for A.I seeing your char and shooting wen near.
first create a big active object(like a circle or sumtin)maike it real big like 3 times your character.Make sure the hot spot is in the midle of the object. Now heres the events for it
-always
*set pos to (0,0) from char
*make invisable
now that u done that set the event for when your active object overlaps the enymey he shoots or puncg or what ever u want him make sure u have it every second or sumtin cuz u dont whant him to shot like 100 bulets.
-site field is overlapping (enemy)
+every 00-80
*shoot bullet right at (what ever speed)
* set direction to left
now thats only when your sitefield is facing right now u have to make it that when its left side is overlapping the enemy it shoots bullet to the right
-X sitefield is overlapping enemy
+every 00-80
*shoot bullet right at (what ever speed)
*set direction to right
now say that u want to have it like u have a bird or sumtin and u want it to attack your guy and bounce back up or sumtin u could do this
-sitefield is overlapping(bird)
+only one action when event loops
*look at (0,0) from char
now so that wen the sitefield is overlapping the(bird) it only attacks once every time the field is overlapping them.
Thats all for now i hope this helps yall out there whom asked me to do this
|
|
Kaine
Registered 12/01/2003
Points 458
|