I need help with pathfinding in 2D and 3D
the first help i need with pathfinding is for a pacman like game
heres an example
Function UpdateGhost(G.ghost)
Select G\state
case STATE_ALIVE
G\xv = PathFindXV(G) ; I need help writing these
G\yv = PathFindYV(G) ; 2 Functions
G\x = G\x + G\xv
G\y = G\y + G\yv
Case STATE_BLUE ;Ghosts turn blue and edible
G\xv = PathFindEscapeXV(G) ; And i need help with these
G\yv = PathFindEscapeYV(G) ; two functions
G\x = G\x + G\xv
G\y = G\y + G\yv
Case STATE_DEAD
KillGhost(G)
End Select
End Function
;====================================================
Ok So for this code above I need help writing the PathFindXV and PathFindYV functions, which are supposed to tell the ghost which direction to go based on where pacman is in the game.
And for a 3D Game i would just like a short sample on how you would have a Ball and a wall just like this:
|||X
O | |
| |
And the ball is told to move to point X
like this:
Function OrderObjMove(SomeEntity,x,z)
Repeat
;Repeat moving the entity toward point X, avoiding collision
;with the wall by moving around it
Until (EntityX(SomeEntity) = X and EntityZ(SomeEntity) = Z)
End Function
How would I go about making the ball swerve around any collisions it would come upon?
I know this is long but thanks for any help.
the first help i need with pathfinding is for a pacman like game
heres an example
Function UpdateGhost(G.ghost)
Select G\state
case STATE_ALIVE
G\xv = PathFindXV(G) ; I need help writing these
G\yv = PathFindYV(G) ; 2 Functions
G\x = G\x + G\xv
G\y = G\y + G\yv
Case STATE_BLUE ;Ghosts turn blue and edible
G\xv = PathFindEscapeXV(G) ; And i need help with these
G\yv = PathFindEscapeYV(G) ; two functions
G\x = G\x + G\xv
G\y = G\y + G\yv
Case STATE_DEAD
KillGhost(G)
End Select
End Function
;====================================================
Ok So for this code above I need help writing the PathFindXV and PathFindYV functions, which are supposed to tell the ghost which direction to go based on where pacman is in the game.
And for a 3D Game i would just like a short sample on how you would have a Ball and a wall just like this:
|||X
O | |
| |
And the ball is told to move to point X
like this:
Function OrderObjMove(SomeEntity,x,z)
Repeat
;Repeat moving the entity toward point X, avoiding collision
;with the wall by moving around it
Until (EntityX(SomeEntity) = X and EntityZ(SomeEntity) = Z)
End Function
How would I go about making the ball swerve around any collisions it would come upon?
I know this is long but thanks for any help.