• entries
61
131
• views
32330

# Progress.

171 views

Hello!

I'm so happy with the way things are going. I managed to iron out some bugs aswell as implement simple enemy AI(including shooting). However the AI is not the fancy stuff I made last time. It's all if(enemy > player) enemy.x++ EX.
No AITarget->y here [grin].
This means that I won't be able to do fancy formations and so on, which ultimately means that it won't be like a good Space Invaders clone. I'am sorry but I still remember that 3 day rewrite it took me to refactor the classes so that AITarget was the base class instead of CObject. But, I promise that the next project of mine will include fancy AI [smile](I might even end up rewriting this project's AI, I really don't know what I'll do, depends hugely on your input...).
Anyway there is still one bug which is irritating, but which I know the nature of(I think). I have set up the AI so that it shoots only when it is at the exact same Y-coordinate as the Player. So that means that if the player is at 333 or some other annoying coordinate which is not dividable by 4(I haven't checked if 333 is, however) then the enemy can't reach it, and it will be "lagging" back and forth between 334 and 332.

So yeah, a heck of a weekend, and I was sick today aswell. Will go back to school tomorrow though.

Here are some screens of the enemy shooting at me:

This was without a bugfix(Enemy firing constantly)

And this was with(Enemy fires only one shot)

I'm gonna go and find a solution to that coordinate problem, if you guys(and gals, if any) have any idea, then It is much appreciated [smile].

Laterz,

if enemy.state != cooldown
if (enemy.y > (player.y - 2)) && (enemy.y < (player.y +2))
enemy.fire()


would this work?

Yeah I don't know why I didn't think about that before [grin].

Thanks alot!

## Create an account

Register a new account