How to shoot towards a moving actor but allow the player to dodge the projectile?
I followed tshirtbooths video in how to recycle bullets etc. This is wired up correctly, when im shooting I am interpolating to the x and y co-ordinates of my player. When the projectiles get shot at me, it seems to always hit me, which is correct but does anybody have any idea in how i can go about allowing the player to dodge this, spent days and can't get it working.
note: I tried several ways, i interpolated
1. The projectiles self.position.x, self.position.y to players x and y
2. i also tried self.motion.linear.velocity x and y to players x and y
(Haha, when i do 2, the projectile travels in random locations.)
Happy new year
Dan
note: I tried several ways, i interpolated
1. The projectiles self.position.x, self.position.y to players x and y
2. i also tried self.motion.linear.velocity x and y to players x and y
(Haha, when i do 2, the projectile travels in random locations.)
Happy new year
Dan
Comments
but the problem that i seem to be having is, my shooting actor is in a non scrollable layer, when my player is within xsize 0-320 and y size 0-480, it works fine, but when my player goes greater than the y.480 my shooter actor shoots a bullet greater that where my player position is. Now if i put the shooter in a scrollable layer, this works fine but,i have to use a constrain attribute to move the shooters y position to my players y, and i do not want to do this.
If anyone can help, awesome...
Just do a change velocity. If you interpolate to the players x and y it will continually update the x and y its moving to. I personally would prob just spawn a bullet also. If the actor is small your not likely gonna notice each bullet increasing the ram or being much on the processor. For example Alpha Balls plays very well and it spawns several Thousand Bullets each round.
Personally I think Recycling is over rated. There are definitely places it needs to be used but quite honestly on little things like bullets I don't think the benefits are worth the extra time and effort to get it working right.
Thanks for your advice, i will try that..