Binding 8-movement to perspective

Get help using Construct 2

Post » Fri Mar 01, 2013 3:59 pm

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?Ottomic2013-03-01 16:04:55
B
4
Posts: 9
Reputation: 345

Post » Fri Mar 01, 2013 5:18 pm

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.
B
14
S
4
G
3
Posts: 38
Reputation: 3,741

Post » Fri Mar 01, 2013 5:44 pm

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
B
6
S
1
G
1
Posts: 70
Reputation: 702

Post » Fri Mar 01, 2013 5:52 pm

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)-> https://www.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.Ottomic2013-03-01 17:54:13
B
4
Posts: 9
Reputation: 345

Post » Fri Mar 01, 2013 6:09 pm

[QUOTE=cincipon] 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[/QUOTE]

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! :DOttomic2013-03-01 18:10:09
B
4
Posts: 9
Reputation: 345

Post » Fri Mar 01, 2013 6:23 pm

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. =)cincipon2013-03-01 18:24:32
B
6
S
1
G
1
Posts: 70
Reputation: 702

Post » Fri Mar 08, 2013 11:45 am

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!
B
4
Posts: 9
Reputation: 345

Post » Fri Mar 08, 2013 4:32 pm

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.)
B
6
S
1
G
1
Posts: 70
Reputation: 702

Post » Mon Mar 11, 2013 9:16 am

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.

https://www.dropbox.com/s/ir84j5jurqeg42z/Movementsystem.capx
B
4
Posts: 9
Reputation: 345


Return to How do I....?

Who is online

Users browsing this forum: MarkThomas, signupdemo and 0 guests