-
Senior Member
Well I was just hanging arround so let me give you some inspiration:
Todays topic :
===============================================
PAC-MAN LIKE GAMES AND PATH FINDING ALOGORITHMS
===============================================
1. WayPoint Patrol -- the bad guys have a preddifined arryas to patrol. this cand be done with empty movie clips positioned arround like a waypoints. Get their x,y and move your bad guys to that points.
2. BloodHunters -- a combination of WayPoint Patrol and Distance measuring. When your Pac is too far away your bad guys will use WayPoint when the Pac is closser they will follow it till the distance is to big, then they go back to the WayPoint.
3. RealHunters -- the bad guys will follow you allways.
Was that helpfull?
Mad-Sci
PS acutaly Ill try to do some samples of that. the next topic will be Distance Measurments.
FlashGuru R U willing to add something it will be nice topic dont you think?
-
Ive already done distance measurements Mad-Sci You Want The Code?You got the code:
=====main timeline=====
Set Variable: "iterations" = 15
=====inside moviclip on main timeline(Frame1)=====
Set Variable: "xdif" = Int (GetProperty ( "/drag", _x ) - GetProperty ( "/center", _x ))
Set Variable: "ydif" = Int (GetProperty ( "/drag", _y ) - GetProperty ( "/center", _y ))
If (xdif < 0)
Set Variable: "xdif" = xdif * -1
End If
If (ydif < 0)
Set Variable: "ydif" = ydif * -1
End If
Set Variable: "x2" = xdif * xdif
Set Variable: "y2" = ydif * ydif
Set Variable: "c2" = x2 + y2
=====inside moviclip on main timeline(Frame2)=====
Set Variable: "n" = 1
Set Variable: "counter" = 0
Loop While (counter</:iterations)
Set Variable: "n" = n - ((n*n - c2) / (2*n))
Set Variable: "counter" = counter+1
End Loop
Set Variable: "distance" = Int (n) +1
Uses Square Root To Find The Distance!!!
-
Mad-Sci Your pacman Mad!!!ill be puting the url of our new game up here soon!!!!!!Dungeon Crawlers!!!!I Have used the hotspot method too!!!
-
Senior Member
Hey FG here is a bit of update:
1. when you are between to blocks you can move either left or right for exampl. or up-down if you wish. When you are over a hot spot you pick a direcion once you pick that your guy will move to the next hot-spot what I did was to put a bar tile just between the two blocks. When you re inside of that bar your _x is adjusted to the bars _x so you will travel right in the middle. Once you leave that bar you are on a hot-spot for picking a new direcion. This is realy cool.
Mad-Sci
do you agree that hot-spoting is cooller than tile collision detection. realy fast.
-
Yes!! I do matey!!!there is only one prblem what if you have loads of crossroads and junction sin your game??then you have alot of hotspots and so less performance!!!!Its till better and more reliable than using a collision detection script!!!
Regards Flashguru
-
Senior Member
Way Point Patrol exampl
Ok as I promissed this is the first exampl of Path finding:
WayPoint Patrol. Stay tuned for the next demo: Blood Hunters
http://savco.virtualave.net/fLASH/pa...t/waypoint.htm
Mad-Sci
The source will be posted this afternoon.
-
Senior Member
Blood Hunter example
This is the seccond set of exampls about the path finding:
2. Blood Hunters:
With this type of path finding the bad guys will use waypoint patrol. When the Pac_man gets close enough they will chase it till it escapes. then they will go back to patrol.
http://savco.virtualave.net/fLASH/pa.../bloodhunt.htm
dont forget to click inside the fla to activate the buttons.
Mad_sci
-
Heres A Very useful script that i use often:
Set Variable: "i" = 1
Loop While (i <> 11)
Set Variable: "rnd" = Random (10)
Set Variable: "x" = 1
Loop While (x <> (Length(Temp)+1))
If ((Substring (Temp, x, 1)) eq rnd)
Set Variable: "rnd" = ""
End If
Set Variable: "x" = x+1
End Loop
If (rnd ne "")
Set Variable: "Temp" = Temp & rnd
Set Variable: "i" = i + 1
End If
End Loop
All it does is create unique random numbers!!!
Very Handy To Know!!
Regards Flashguru
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|