Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / 2d game AI

Author
Message
EddieV223
14
Years of Service
User Offline
Joined: 24th Sep 2010
Location:
Posted: 30th Sep 2010 22:35
I am trying to find out how to make a AI controlled ship shoot at the players ship at any angle. thanks

Learning c++ is a biznatch!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 4th Oct 2010 18:37
Try dbPointObject(obj,x,y,z). The xyz is the target ship and the obj is the firing ship.

The fastest code is the code never written.
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 4th Oct 2010 19:36 Edited at: 4th Oct 2010 19:41
Well yes, as Hawkblood said, all you need to do (well, the easiest way..) is to point the sprite to whereever you want to shoot and move the sprite (dbMoveSprite, will move it forward, depending on the angle), unfortunately there is no dbPointSprite function, but well i think i was using this one:



I did not write it originally, i found it somewhere on the forums (a bit too old post..)

hope that helps

also keep on a note: point the bullet sprite just once when you shoot unless you want it to be following the target, so that the target sprite can move to avoid the bullet, and you can use dbSpriteCollision between the bullet and enemy sprites to check if they're colliding, if so, do damage or whatever you want

[url][/url]
Nothing's impossible, it's just a matter of time...

Login to post a reply

Server time is: 2024-11-19 18:22:09
Your offset time is: 2024-11-19 18:22:09