Author Topic: Twin stick shooter playertype  (Read 2201 times)

I'm trying to get back into scripting for Blockland again, and my first project is a twin stick shooter playertype. Top down camera (already done), WASD will move like normal (done, duh), but I need it so when you press the arrow keys the minifigure shoots/swings in the direction you pressed. (combine up+left, down+right, etc. to fire diagonally)

Also need to keep the minifigure from walking in the direction it's shooting, W should always move up, A should always move left, etc.
The ability to move the camera with the mouse should be disabled, too.

If all of this is actually possible, might I enlist the help of a coder or two who is already experience with TorqueScript?

EDIT:

I guess I should have been more specific: I know richard all about Torque script, I have no idea how to use it and finding resources is really difficult. I need more guidance.
« Last Edit: April 19, 2015, 12:23:38 AM by VerticalHorizon »

Most of this would be possible server-side, though you may have to jump through some hoops to get the orthogonal movement in place. Maybe you could mount the player as a bot to an invisible player object that the client is actually controlling, then use a script loop to keep it always facing the same direction, while rotating the mounted player object to face the direction of fire. You can't have the client make keybinds from the server side, but you can probably wire up the brick shifting command to your directional shooting, so hitting shift brick forward fires north or whatever. Still, this is getting a bit involved for a first project.

Make the client control their camera. Make the camera orbit the player at a constant angle. Make the camera control the player. Make the player have uniform movement speeds with look angle limits on pitch. Enable world space movement (setWorldSpaceMovement). You'll want a client-sided add-on for the arrow key controls.

I was actually hosting a proper top down DM a few days ago (well, except that you aimed with your crosshair, not with the arrow keys).

Okay this sounds like quite a task but I don't think it would be impossible. The first hurdle is that the original Top Down Player code by Rotondo isn't functioning the way it used to. The camera only lifts up and zooms out a bit; the camera is no longer top down. What might that be?

Okay this sounds like quite a task but I don't think it would be impossible. The first hurdle is that the original Top Down Player code by Rotondo isn't functioning the way it used to. The camera only lifts up and zooms out a bit; the camera is no longer top down. What might that be?

Make the client control their camera. Make the camera orbit the player at a constant angle. Make the camera control the player.

I guess I should have been more specific: I know richard all about Torque script, so I'm sure what he said is exactly the right thing to do, I just have no idea how to do it and finding resources is really difficult. I need more guidance.

I guess I should have been more specific: I know richard all about Torque script, so I'm sure what he said is exactly the right thing to do, I just have no idea how to do it and finding resources is really difficult. I need more guidance.
First you're gonna need a playertype to use as a base. Make/copy one and get it to work. Then figure out how to transfer the view to the camera. I believe there's a default add-on that relates to this, the one used by speedkart at the end of the race. Look through that for something that seems relevant. Next figure out how to run a script when you start using a certain playertype. Might be harder to find; the phrase to look for is onNewDatablock. Find a playertype that uses it and learn how it works. Then you combine all these things together. Feel free to ask if you need more help, but this will be a start to build upon.

You'd probably be better off using the brick shifting keys for shooting to dodge the necessity of a client add-on.