how to make it so i can double tap a button to perform a alternative action and how to make an alternative action when two buttons are held. Example walking diagonally when north and east are held
1
2
Aug 30 2015, 10:12 am
|
|
http://www.byond.com/developer/?text=tag%3amovement , I believe there are few good libs here you can find about this subject.
|
In response to Zagros5000
|
|
looking at ters honestly that should be built into byond, why the default setup of touching keys in a game engine is so advance is beyond my comprehension. This should literally be the easiest thing to do like every other game engine which usually is 1 line of code.
Its why we have so many games with no controls at all and just verb panels |
I have a hidden library that lets me write code like this:
mob The code that makes this work is less than 150 lines. Even though it took me less than an hour to write, I never have to write that code again. It might as well be part of the engine. I don't even have to look at it. It would be "nice" for a game engine to support this natively, but now that I've so easily written it, I don't even need it to be supported natively. But the nice thing is, since I have access to its source code, I can modify or extend it if I want to. You can't do that with the BYOND engine. |
In response to Kaiochao
|
|
yes i realize you can make functions to make your life easier in programming languages. What I don't realize is why dream makers default setup is so bad to the point it doesn't make sense. Obviously I am well versed in basic controls, but I still find the way to set up basic controls nonsensical. Sorry just me ranting, It's the one thing I've probably disliked the most.
Like i said the proof of this is in the number of people who make games without any button controls. Buttons should not be an intermediate level to set up. It should be the most basic thing. And like unity take 1 line instead of 150 |
In response to DanteVFenris
|
|
If you make a library for the kind of movement control system you want, then any project that uses it will have taken you 0 lines to include it, instead of 1 or 150. Just download the library and check the box and you're good to go.
Also, I've used Unity. It takes a lot more than "writing one line" to move a GameObject with WASD or arrow keys. 1. Click your GameObject. 2. Add a Rigidbody2d to your GameObject. Maybe a 2D collider component too. 3. Add a New Script to your GameObject for player movement. 4. Get that Rigidbody2d into your player movement script with GetComponent<>(). 5. In Update(), Get the "Horizontal" and "Vertical" axis values using Input.GetAxis() or Input.GetAxisRaw(). If you don't want to be using WASD or the arrow keys, you have to change this in the Input Manager. 6. Apply force to the Rigidbody2d according to the input vector. The DM equivalent of setting up the Input Manager's controls, using my keyboard handling library: mob The DM equivalent of that player movement script: mob |
#define TICK_LAG 0.25 //set this to 10 divided by world.FPS This is how you define macros: W MoveKey 1 1 This setup will keep track of several things for you: 1) The number of taps in a sequence. (client.key_taps) 2) The time that the key was last pressed/released (client.key_time) 3) Whether a key is currently held down. (client.key_state) client.MoveKey() and client.BindKey() is where most of the magic happens. By default, it modifies the current state of the key lists, then the functions are all about being overridden and changed. Pay close attention to the lists in the client variables. If you add bindkeys, you need to change the length of the list to match the maximum number of keys that it can track. |
In response to Kaiochao
|
|
Kaiochao wrote:
If you make a library for the kind of movement control system you want, then any project that uses it will have taken you 0 lines to include it, instead of 1 or 150. Just download the library and check the box and you're good to go. > mob The DM equivalent of that player movement script: > mob wrote up a quick movement system in unity its really more simple than byond movement because be defualt movement is just so smooth. using System.Collections; |
In response to Hebrons
|
|
DM (60fps, recorded at 30fps):
Looks smooth to me. Entity loop, a basic equivalent of Unity's GameObjects with components that update periodically, analogous to... using Unity: world Adding a component to a player, analogous to adding a MonoBehavior to a player GameObject: entity/Login() Movement component, analogous to your Movement MonoBehavior: component/player_movement But actually, in Unity, you could also do it like this: void Update() { In DM, I've done that like this: Update() |
To be fair, you aren't really using C# in Unity either. You are using MonoC# --different animal.
|
In response to Ter13
|
|
Ter13 wrote:
To be fair, you aren't really using C# in Unity either. You are using MonoC# --different animal. i know lol just curious. |
In response to Ter13
|
|
This is how you define macros: > W MoveKey 1 1 i dont get this part. Where does this even go. Just get erros when i copy and paste. I assume this is to set up controls but ive never come across this. |
i dont get this part. Where does this even go. Just get erros when i copy and paste. I assume this is to set up controls but ive never come across this. These are the settings for your macros in the DMF file. |
In response to Ter13
|
|
i know this is old but anyway you can think of a way to modify it to be pixel based. Tile based is way way too fast.I know i can change the lag time but that makes it kinda look ugly as im sure you know.
I tried using a couple scenarios but all of them would break your idea. Maybe i just dont understand something well enough. I know where i need to modify, just can't think of a way to modify it to allow it |
Tiled movement fix:
Tile based is way way too fast. You don't want to slow down the loop. You want the loop to force the player to try to move every frame. Modify movables to track their own movement speed. The client should not need to know any of this information to drive a movable. I know i can change the lag time but that makes it kinda look ugly as im sure you know. Change the glide size to mitigate the ugliness. #define MOVE_TURN 1 Pixel movement fix: As for changing it over to pixel movement, the default client Move() function sucks for this. It's designed for tiled movement, and has always sucked for pixel movement overrides. Let's just write a better hook for handling it client Now, we just modify the MoveLoop function: proc Boom, pixel movement compatible. |
In response to Ter13
|
|
What if you did this:
client |
1
2