Author Topic: Side scrolling player w/ no mouse function  (Read 2545 times)

Alright i'll keep this simple:

I'm working on a castlevania gamemode. I got a bunch of stuff done, but one roadblock that has bothered me is the playertype. I need some code for a player that:

Most importantly puts the camera on the right side of the player, facing the player. I can adjust the distance myself

Prevents the use of aiming/mouse so that players can only move in whatever direction they spawn in, or backwards, but cannot strafe at all (The player is restricted to a 2d Plane of movement)

Changes the inputs required to move the player. Instead of the player walking forward with W, and backwards with S, and so forth,

the player moves forward (Or right on the 2d plane of movement) using the d key, and backwards with S, while always facing forward.



So basically a mario/castlevania side scrolling playertype.

If somebody knows how to do this, please post the actual code. no psuedocode or 'it kinda works like this'

This is Coding Help. Not Suggestions & Requests.

Changes the inputs required to move the player. Instead of the player walking forward with W, and backwards with S, and so forth,

the player moves forward (Or right on the 2d plane of movement) using the d key, and backwards with S, while always facing forward.

Not possible without a client sided mod.

package foo {
    function yaw(%delta) {}
    function pitch(%delta) {}
    function moveForward(%state) { jump(%state); }
    function moveBackward(%state) { crouch(state); }
    function moveLeft(%state) { Parent::moveBackward(%state); }
    function moveRight(%state) { Parent::moveForward(%state); }
};

activatePackage("foo");

package foo {
    function yaw(%delta) {}
    function pitch(%delta) {}
    function moveForward(%state) { jump(%state); }
    function moveBackward(%state) { crouch(state); }
    function moveLeft(%state) { Parent::moveBackward(%state); }
    function moveRight(%state) { Parent::moveForward(%state); }
};

activatePackage("foo");

OP, note that this is client sided and does not contradict my previous statement.

This is Coding Help. Not Suggestions & Requests.

This isn't a suggestion or request. I actually need help making this. I'm trying to code the player atm.

Not possible without a client sided mod.

Yeah, I realized that a while ago. it's going to be a single player gamemode for now.




package foo {
    function yaw(%delta) {}
    function pitch(%delta) {}
    function moveForward(%state) { jump(%state); }
    function moveBackward(%state) { crouch(state); }
    function moveLeft(%state) { Parent::moveBackward(%state); }
    function moveRight(%state) { Parent::moveForward(%state); }
};

activatePackage("foo");


Thanks port. This is all I needed! I'm gunna test a few things and I have any further questions i'll post them back here, so for now, no lock.

Edit: nevermind I got it
« Last Edit: May 02, 2015, 05:45:55 PM by Path »

The D and A key are usually left and right. Soo

Code: client.cs (10 lines)
package foo
{
    function yaw(%delta) {}
    function pitch(%delta) {}
    function moveForward(%state) { moveRight(%state, 1); }
    function moveBackward(%state) { moveLeft(%state, 1); }
    function moveLeft(%state, %override) {if(%override) return Parent::moveLeft(%state);}
    function moveRight(%state, %override) {if(%override) return Parent::moveRight(%state);}
};
activatePackage("foo");

« Last Edit: May 02, 2015, 05:48:17 PM by Advanced Bot »

The D and A key are usually left and right. Soo

function moveLeft(%state) { Parent::moveBackward(%state); }
    function moveRight(%state) { Parent::moveForward(%state); }

(Don't forget to package)

Yeah what I didn't realize is that they are actually inverted when executed, but I got it through thx

Yeah what I didn't realize is that they are actually inverted when executed, but I got it through thx
Must have seen my ninja edit.

Must have seen my ninja edit.

Nah I just tested port's thing so I realized it was inverted



Also bigger question: How do I camera?

I've looked it up a bit and I see that changing the player's 3rd person camera to be on the side is possible, but rotating it to look at the player isn't. So is there any fancy trick i can do with a camera object? Like, probably mount a new camera to the player off to the side, with certain coordinates?



Again kinda like dis

The D and A key are usually left and right. Soo

Code: client.cs (10 lines)
package foo
{
    function yaw(%delta) {}
    function pitch(%delta) {}
    function moveForward(%state) { moveRight(%state, 1); }
    function moveBackward(%state) { moveLeft(%state, 1); }
    function moveLeft(%state, %override) {if(%override) return Parent::moveLeft(%state);}
    function moveRight(%state, %override) {if(%override) return Parent::moveRight(%state);}
};
activatePackage("foo");


Wait, what? That'd just disable A and D though and make W and S do what they'd do instead..


Camera...

You'll want to make the client control their camera, make their camera control their player and to make their camera orbit their player at the angle you want.

%client.setControlObject(%client.camera);
%client.camera.setControlObject(%client.player);
%client.camera.setOrbitMode(%client.player, <transform>, <minDist>, <maxDist>, <curDist>, true);

This isn't a suggestion or request. I actually need help making this. I'm trying to code the player atm.
Coding help is for if you have code but it isn't working, need a few pointers on how to do something, etc.

Asking someone to make it for you:
post the actual code. no psuedocode or 'it kinda works like this
Is a request, and thus this goes in s&r

You'll want to make the client control their camera, make their camera control their player and to make their camera orbit their player at the angle you want.

%client.setControlObject(%client.camera);
%client.camera.setControlObject(%client.player);
%client.camera.setOrbitMode(%client.player, <transform>, <minDist>, <maxDist>, <curDist>, true);


Thank you. Also I have a bit of a problem with the @param mat, or transform, it has aparently 7 possible float values, posx posy posz aax aay aaz aaTheta. How would I squeeze that in?

I'm trying setOrbitMode(%client.player, "x y z a b c theta", etc. but it won't exec


sorry if i'm being a bother at this point