MaD2ko0l Posted January 18, 2014 Share Posted January 18, 2014 Hi, New to LUA and programming. I have made a top down view scroller and i have got the basic controls working how i want them, however, i am a stuck with the shooting aspect and dont really know where to look. the FPSPlayer/FPSWeapon lua isnt really helping me understand. what i am after is when you click the mouse i want it to shoot a small laser beam from 2 points on the ship and simply move in a straight line and off the screen unless it hits and enemy. Can someone point me in the right direction or know of a tutorial or something? Regards, Martin Quote Link to comment Share on other sites More sharing options...
YouGroove Posted January 18, 2014 Share Posted January 18, 2014 A missile beam if we could say. You just need to create the missile at shooting canon when clicking on right mouse (or more optimized, show some hidden missile instead of creating/detsorying it) So show the missile at canon position, than move forward in player direction (PhysicSetPosition function), when missile has run some good distance just hide it or put it to a non visible position like (-500,-500,,-500) Quote Stop toying and make games Link to comment Share on other sites More sharing options...
DudeAwesome Posted January 18, 2014 Share Posted January 18, 2014 should be possible to create some ballistcs like parabel and so an. I´m trying to do something like a bullet find its target always with a beziercurve. in 2d no problem to implement in 3d I need more time ;D Quote It doesn´t work... why? mhmmm It works... why? Link to comment Share on other sites More sharing options...
Christian Clavet Posted January 19, 2014 Share Posted January 19, 2014 Hi, I'm new and don`t have the exact answer but I hope theses recommendations would help. If you need to use projectiles like on gun bullets and the velocity is really high, I would recommend using "raycasts" to find the collision point and then once you get the collision point (when you fire the weapon), you could do some visuals to show the damage. For bullets, it could be a simple 3D line that is draw for 1-2 frames (this would show the bullet trajectory) For a rocket launcher, could be the same thing, you move the missile (you would need to "spawn" the missile from the launcher) to the collision point and put a particle trail behind (particle emitter attached to the missile). If you decide to "lock" on a moving target with the missile, you should create a script that move and update the missile trajectory until it has hit the target. (when it was "locked" with the raycast) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.