AI game Tutorial by Hotshot | No Votes
| For general use |
-->
|
Latest Comments
| Posted : Wednesday, 13 June 2007, 05:30 |
JL235

 
| That's not really AI, it's just following the player continuously. AI is suppost to have decisions, so it might track the player but be off at some point. This helps to give the illusion (if only minor) that you are playing against someone.
Even then, it only moves in eight directions. You should find the angle between the computer and the player, then move along the x and y axis using sin and cos. This will also fix the bug that the computer moves faster diagonally then when moving vertically or horizontally (as it's moving both vertically and horizontally).
You should NOT capitalize a non-constant. This is because by capitalizing a constant it helps to show it's a constant. If I wrote 'SPEED' and 'angle' in my code, you can then know instinctively that SPEED is a constant and angle isn't.
Finally, there are tags for code, [ code ] and [ /code ] (with the spaces removed). There used to be a window explaining those tags.
| | Posted : Wednesday, 13 June 2007, 06:03 |
Hotshot
 
| thanks for commets and it is learn from people like you.
cheers
| | Posted : Wednesday, 13 June 2007, 06:27 |
Jayenkai

 
| When properly dealing with Constants*, I prefer to symbolise which is which using a more specific manner, like placing "C_" before the variable name.
Beats having to uncapitalise everything else, anyway.
(* Honestly though, I rarely use constants..)
| | Posted : Wednesday, 13 June 2007, 06:58 |
JL235

 
| The convention used in the industry, and by the vast majority of programmers, it to fully capitalize constants and not to fully capitalize non-constants.
| | Posted : Wednesday, 13 June 2007, 08:39 |
Teasy

 
| Or use syntax highlighting where constants, globals and locals all have a different visual representation (note explicitly to read the code with advanced syntax highlighting )
Nice tutorial, Hotshot 
It's very clear when reading it.
| | Posted : Thursday, 14 June 2007, 08:32 |
Hotshot
 
| it is very old code!
Thanks teasy and everyone too
| | Posted : Thursday, 14 June 2007, 13:42 |
iusinbello
 
| Where is the AI??? I see only a quad followed by another quad... O_o
|
|