mirror of
https://gitlab.com/drummyfish/anarch.git
synced 2024-08-13 15:53:48 -04:00
Continue AI
This commit is contained in:
parent
3072597787
commit
53d4b86b0a
@ -58,6 +58,12 @@
|
||||
Rate at which AI will be updated, which also affects how fast enemies will
|
||||
appear.
|
||||
*/
|
||||
#define SFG_AI_FPS 5
|
||||
#define SFG_AI_FPS 2
|
||||
|
||||
/**
|
||||
Says a probability (0 - 255) of the AI changing its state during one update
|
||||
step.
|
||||
*/
|
||||
#define SFG_AI_RANDOM_CHANGE_PROBABILITY 20
|
||||
|
||||
#endif // guard
|
||||
|
5
main.c
5
main.c
@ -1015,6 +1015,11 @@ void SFG_monsterPerformAI(SFG_MonsterRecord *monster)
|
||||
coordAdd[0] = 0;
|
||||
coordAdd[1] = 0;
|
||||
|
||||
if (SFG_random() < SFG_AI_RANDOM_CHANGE_PROBABILITY)
|
||||
{
|
||||
// sometimes randomly change state
|
||||
state = SFG_MONSTER_STATE_IDLE;
|
||||
}
|
||||
if (state == SFG_MONSTER_STATE_IDLE)
|
||||
{
|
||||
switch (SFG_random() % 8)
|
||||
|
Loading…
Reference in New Issue
Block a user