Ok so I am working on a Gundam like Mech Game and what I am trying to do is make it so when a player gets onboard the mech, the camera view changes from the character being in the center of the screen to kind of like an over the shoulder type view were the camera view always shows the characters back and say I want to go right, instead of the map scrolling right as the character moves with the character in the center, the player would turn right and basically the camera view turns to, like I said like in most modern games I want like an over the shoulder view like say in most rpgs, not a first person view. I'm just curious if anyone here has experimented with this type of view or if anyone can point me in the right direction to a library or add-on or tutorial. Thanks in advance
ID:2125987
Aug 3 2016, 1:24 am
|
|
well how bout if instead I decide to make it so say the mech is moving right, say the map is a 11x11 view, and if I move right, instead of centering on the player, the player would be a 1,6 instead of 6,6 and if I move say down the player would be at 6,11 and so on like if going up then 6,1 and 11,6 for left? is that possible?
|
I just want it so when the player is in the mech he can only see infront of him not behind you get what I am saying?
|
Positioning the camera can be done with client.pixel_x/y, for keeping it ahead of the player. Have you looked it up yet? If you want the camera to be in front of the player, you need to change those variables. For example, if the player is facing east, client.pixel_x should be some positive number, and client.pixel_y should probably be zero. |
I experimented with this idea on an old game of mine a while back -
As Kaio said, changing client.pixel_x/y is the way to do it. Thought I'd share how I managed to get mine to look through that method. |
In response to Ishuri
|
|
man it took me a while to even notice you posted this, thanks for the assist guys a year later lol, i kept messing up and decided to just go back to working on my star wars game since i lack the necessary sprites for a mecha game
|
Well, here is what you wanted:
mob |
Or you could be a total badass and write a system that allows you to turn the map around your character.
It's kind of a whore to get to render properly, but it looks pretty cool when you can get it to work. |
sounds like it, is this something that you have tinkered with and know is possible or just a concept that you have had?
|
I've seen it done before on much older versions of BYOND, pre-4.0 I think.
It rendered like dogshit, but worked as a single-player concept. I'm pretty sure you could get it to work a bit better on newer versions, but you'd probably still be doing a lot of the rendering yourself. It really just depends on how well the map can handle being turned dynamically. |
obj/rotation_plane (Written off the top of my head, it might be pretty broken) |
In response to Nadrew
|
|
obj/rotation_plane |
In response to Nadrew
|
|
There's probably a cleaner way to do it in general, I just happened to notice that yours didn't actually do anything :p
|
proc/dir2angle(dir) // converts a direction to an angle -- credit to Rushnut for the original helper proc OK, this will literally put the camera behind you at all times (rotating it around the player character like Kats described -- definitely not a whore now that plane masters are a thing). Just make sure to put all of your HUD objects on a separate plane. Two things to note: 1) This is a little disorienting. Just because your screen follows behind you doesn't mean your controls change. To actually have this feel natural, you would have to shift movement controls depending on player direction. 2) I would recommend setting your view higher than you want it to be, then scaling the plane_master in. Otherwise you're going to see the blackness outside of the view port both when rotating and when moving diagonally. Edit: Working on this made me realize that since MATRIX_SCALE is really just matrix multiplication, this transform = matrix(angle,MATRIX_ROTATE) * 2 is completely valid syntax. Seems really obvious in hindsight, but I had never considered it before. |
right well thanks everyone for your help and idk if I ever explained what it was for cause maybe thatd effect how you code it, basically what I'm doing is making a gundam like game and I'm trying to make it so once you get in the cockpit of the suit it alters the camera view so you can see only infront of you just like an actual cockpit. I may incorporate something like a rear view mirror for seeing behind that way its somewhat realistic
|
If you're fine with the camera instantly snapping to one of 4 directions, you can use client.dir. Positioning the camera can be done with client.pixel_x/y, for keeping it ahead of the player.