Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I lock the Z Axis of a character in a 2D game?

Asked by 6 years ago

I'm trying to make a small 2D fighting game where characters can only move along the X or Y axis, which is easy enough for me to code, but the game also involves knocking/flinging players around the map, which can easily send them into the background/foreground out of the control of the player.

I was wondering if this could somehow be prevented, so all players are forced to stay at Z = 0, for example. The closest thing I can think of is simply invisible walls, but I was wondering if there is a more effective alternative out there?

Thanks, Elliott

0
in that case when they move set their cframe to CFrame.new(pos.X, pos.Y, 0) User#19524 175 — 6y
0
pos being their position defined when they move User#19524 175 — 6y
0
Wouldn't that be a lot for the game to run with everyone moving around? Also, I don't think it would work when a player is being flung with no keydown inputs Elliott_RBLX 15 — 6y
0
Not to say there aren't alternatives but wouldn't the invisible wall really be the best solution? I mean your entire map can be covered with 2 walls alone Vulkarin 581 — 6y
0
That's what I'm thinking, it's what I have now, was just curious as to whether or not there was a better suggestion out there... maybe I'll find out eventually! Elliott_RBLX 15 — 6y

Answer this question