Binding 8-movement to perspective

0 favourites
  • 9 posts
From the Asset Store
Fly Bound
$2.49 USD
Design for game, asset for game, game kit, UI design, completed design for game FLY BOUND
  • Hi everyone:

    First of all, sorry for not attaching a .capx file. I think this is more of a theoretical question,.

    so it doesn't really need one. However, please tell me if you nee one.

    qa

    Consider a side-scrolling beat'em'up game where the floor is at an angle (GoldenAxe, Aliens vs Predator arcades). I want my character to move freely on 8 directions, except I want all entities to move at angle when moving on the Z-plane (to or away from the player).

    Now, the problem is, there seems to be no way to alter the angle of movement on a 8-direction behavior, and I have tried setting up custom movement to no avail (deceleration is broken as far as i'm concerned on Custom Movement)

    My ideal solution would be to modify the angle at which the game moves sprites binded to 8-dir behavior. Can this be done?

  • Can't the Custom Movement 'Set Angle of Motion' enable you to create your own system to achieve what you're aiming for? You can also control movement without any of the behaviours and do it entirely manually.

  • Player.8Direction.VectorY < 0 -> Player>Set X>Player.X+(0.01 * Player.8Direction.Speed)

    Player.8Direction.VectorY > 0 -> Player>Set X>Player.X-(0.01 * Player.8Direction.Speed)

    The 0.01 * Speed is because if you just do a linear value, it makes an S shape as you accelerate/decelerate.

    If you want to tweak the amount, start by trying 0.015 or 0.005. It is that sensitive =P

  • Alright, so I've been experimenting a bit more with Custom Movement and I seem to have resolved the main issue I had with this control type: deceleration. I didn't want to use it because, as much as I had tried, I couldn't set a proper deceleration mechanic, which 8-direction includes.

    Anyway, I just sat down and looked at it for half an hour or so and I've been able to actually get a working deceleration mechanic. I'm attaching it to this reply, since although it is incredibly primitive it would have helped me immensely 24 hours ago. It's amazing what just doing something else for 2-3 hours can do when you're stuck with a problem.

    (link to .capx)-> dropbox.com/s/sweho4etr70k4jr/custommovement.capx

    Anyways, I'd appreciate if anyone has any improvements on it. Thanks a lot, and sorry for the typos on the original message-- I was writing it from my cellphone.

  • Player.8Direction.VectorY < 0 -> Player>Set X>Player.X+(0.01 * Player.8Direction.Speed)

    Player.8Direction.VectorY > 0 -> Player>Set X>Player.X-(0.01 * Player.8Direction.Speed)

    The 0.01 * Speed is because if you just do a linear value, it makes an S shape as you accelerate/decelerate.

    If you want to tweak the amount, start by trying 0.015 or 0.005. It is that sensitive =P

    Alright, that was amazing. It is exactly what I was hoping for when I posted this.

    I'll be playing around with the 0.01 vector so it matches my perspective, but other than that, this works like a charm, and I prefer sticking with that for the moment, rather than the Custom Movement.

    Thanks a lot, cincipon! :D

  • Great! I'm curious to see what you come up with further.

    Mine isn't a perfect solution, but I think it'll be quicker to filter the output of 8dir than to build your own from scratch. Glad to be of help at all. =)

  • Well, after working on the movements mechanics for a couple days, I thought it would be helpful to make a mini-update with the overall results. In the end, I've decided to go with the original idea that I posted on this thread.

    The reason behind this is that once I had nailed the deceleration mechanics (which I made with an acceleration at player.movingangle-180), this kind of movement becomes pretty much the same as the behavior, only you can store the values for acceleration and deceleration on the player as instance variables (which is kind of pointless, but I like it that way), and what's more important, although cincipon's solution is really elegant and looks easier, the movement speed stacks up when pressing Up and Left, and Down and Right. At least, it serves better the purpose I need to give it.

    So, thanks a lot, everyone. I hope I'll be able to post my full movement system so you guys can take a look at it. Cheers!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Glad you got it working! If you're in a sharing mood you could post the basic movement capx so other people can benefit from your work =) We need more beat-em-ups. (I'm hoping someone makes another river city ransom style game soon.)

  • Sure thing, I would have liked to find something like this when I was looking into Beat'em'upper movement, or hell, any kind of movement in perspective anyways. It could be more streamlined, but since most of the code is taken directly from my game project (where all the variables and stuff make way more sense) I decided to keep that since it makes the system more versatile all around. Please note that the placeholder graphics for the player are from the Scott Pilgrim game, and as such I don't own them, just in case.

    Anyway, yeah, I really hope I can get it through. I'm working on a system that can allow huge procgenned levels while keeping the onscreen elements at a minimum for a big, awesome B'E'U/RPG of sorts, and even though I wouldn't hold my breath for it, with a community like Scirra's I'd say it's even possible I can make it through. :)

    Thanks again, hope I can help someone in the process, too.

    dropbox.com/s/ir84j5jurqeg42z/Movementsystem.capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)