AnD4D's Forum Posts

  • Hi guys,

    I'm trying to set up a layout which allows 2 ships to be controlled by AI, and move realistically around the layout. I have a very basic movement set up, and the ships are "intelligent" enough to avoid leaving the layout, but it's not anywhere near perfect.

    Ideally, I'd like to use the physics behaviour, but I have more control with the Custom Movement. If the ships approach the edge of the level, they slam on the brakes. I can turn on physics dampening, but I don't get the same results.

    Space Ships

    Does anybody have any advice on how I can improve the movement. I'd like the ships to automatically avoid one another, but try to get close enough to shoot each other. Very hard. Much easier in my head <img src="smileys/smiley36.gif" border="0" align="middle"> I have a good idea for that though, but I'd rather get the movement a bit more intelligent.

    Any advice is appreciated.

  • LOL! Well that was an hour wasted... <img src="smileys/smiley36.gif" border="0" align="middle" />

    Thanks newt!

  • Thanks newt

    Huh... that's what I had... It's just sat there doing nothing...

    Turrets confuse me!

    Please don't be a bug... :(

    On yours, the FPS counter is changing, averaging around 63, but there is no rotating or shooting taking place.

  • Really excited about the turret behaviour... but I honestly cannot get my head around it at all. <img src="smileys/smiley9.gif" border="0" align="middle" />

    I'm not sure how to get the turret to rotate to face the acquired target, or even fire a bullet. Anyone else having issues with it?

    I may just be a little simple... one of my habits it seems <img src="smileys/smiley36.gif" border="0" align="middle" />

  • Thanks for your help sqiddster! I'll keep having a go, and will post if I have any luck!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • What about having everything shrink instead of growing. That way you dont need to worry about zooming. Then, if your npc creatures scale is too small, destroy them.

  • sqiddster The idea was to have a space ship that could move around freely. The player ship's turrets would shoot the enemy weapons if it got within a certain range. I was thinking of basing it on vector rather than speed, as the turrets didn't have movement (so to speak) even though they do move.

    I've tried it with Ashley / code, but they all seemed to aim *dumb*.

    If the ships were just moving I could base the speed, etc off of the ship... but as you said, it's the rotation that seems to mess things up.

    This one got us beat? <img src="smileys/smiley11.gif" border="0" align="middle" />

  • I've still not had any luck - you sqiddster?

    I've made it less accurate, but not smooth (it's very shaky). I'll figure that out next :)

  • Sorry, not 100% sure what you mean, but please find the attached. I've set it so that the layout rotates 1 degree every tick. If you want, you can change it so that at the start of the layout, it is just set to a certain angle.

    CAPX here

  • Hello, back again.

    I got the system working properly with the targeting, however, I then thought about having the enemy able to target the weapons on the ship to disable them.

    This caused an issue in the sense that the turrets do not actually have their own speed or moving angle, as they are pinned, or simply always set to a certain position of a moving object, which is then moving around on its own. I considered having a variable on the item which reads off of the moving sprites speed/moving angle, and then feeding that into the turrets. However, if the sprite is rotating, the turret speed is increased even more.

    Please click here to see an example...

    You can move the blue targets around using the arrow keys, and you should see that they are always being hit... however, if you move them right off screen, the pink target is very rarely hit.

    Is there a way to improve this using method, as it only uses one variable (at the moment) and only a couple of lines.

    Would be greatly appreciated.

  • Wow, Yann! That's impressive stuff! I was trying to think of ways of making sqiddster's code less accurate so the AI isn't such a brilliant shot all the time. Definately appreciated :) Thank you!

  • sqiddster - tried that with closest family member (sounds odd). The aiming process worked as normal, but it remained targeting the first sprite, no matter which one was closest. Should I be using a distance condition instead?

    https://dl.dropbox.com/u/50465867/Construct/Targetting.capx

    *SCRATCH THAT* me being stupid! Missed the positioning section at the top. Also changed it so that it rotates towards, rather than pops direction. Brilliant formula Sqiddster!

  • NECROPOST!!!

    Great example sqiddster!

    Any idea how to have it select multiple targets from the same family, allowing us to have the unit target the closest enemy, or the enemy with the lowest health?

  • Darkflame Thanks for sending it through!

    The great thing about Construct 2 is that there are so many ways to achieve the same thing.

    https://dl.dropbox.com/u/50465867/Construct/Smash%20Tv.capx

    Give this a go, and let me know if you need help understanding it. Also, please note that event order is important. Make sure your character changes direction and THEN shoots, otherwise it will fire before chaning direction <img src="smileys/smiley1.gif" border="0" align="middle">

  • Post a capx, tag me in the post using followed by AnD4D and I'll help you out <img src="smileys/smiley1.gif" border="0" align="middle" />