Hi, I'm picking back up on a space shooter I was making a while ago, and I just can't seem to get this one part down... this is actually why i stopped, so hopefully someone can help. I have been working on enemy movement and I have a few different movement types down but I can't seem to get curved movement down. attached is a diagram of what I'm trying to achieve, roughly, I can't even draw a good curved line but I think you get the idea...
with some if statements for when to change the x direction but i can't seem to get a seemless curve down... Any help, hints, ideas would be of great use. I tried the following code which is a complete flop but I'm including it so you know I've tried things and am not just lazily asking for someone to do it for me:
you need a size to ocilate at and a angle, play around with different combinations. REMEMBER YOUR DEALING WITH RADIANS, 0 - Math.PI is the same as saying 0 - 180
lol, i guess i'm gonna just have aliens who don't drive well and have no interest in making curved turns... thats all greek to me... i give up with this curved movement stuff...
... fine, i'm just tired, i'm not giving up, but i can't try to figure that out till tomorrow morning... thanks for the tips though guys...
or maybe i didnt think enough...
let me think heavier and with a calculator!!
hmm...should work, let me try my computer...yup, works
first, keep in mind that a sine wave looks like your ziz-zag motion, but with the corners rounded, try messing around with some additional variables:
fallspeed sets the how fast your enemy will go down the screen
wobble will set the maximum distance your enemy will move on the x plane (and minimum as well)
wobblespeed will set how fast your ship will wobble (the larger the number, the slower the wobble)
initdistance will set the distance from the left side of the screen your object will be