Skip to content

[Mod] Move with arrow keys

Blake-The-Terraria-Modder edited this page Aug 20, 2011 · 3 revisions

What is this?

I was originally going to call this "Move through walls", but people might think it just turns on pure noclip. It doesn't.
This lets you move using the arrow keys, which can allow you to move through walls. Ever had that problem where you don't want to dig through a huge pile of sand to get to that chest? Not anymore.
The up arrow is set to make you float in your current position, useful for building in the air.

Code:

GitHub code formatting hates me: [http://pastebin.com/T3Zzadfv]
This goes in your OnKey function in ModClass.cs

Bugs:

Sometimes desired, this doesn't update your position on the server. To do this, move using WASD and it will be as if you teleported to everyone else.

~CloudHopper

if (Main.keyState.IsKeyDown(Keys.Down))
            {
                Main.player[Main.myPlayer].position.Y += 5;
            }
            if (Main.keyState.IsKeyDown(Keys.Left))
            {
                Main.player[Main.myPlayer].position.X -= 5;
            }
            if (Main.keyState.IsKeyDown(Keys.Right))
            {
                Main.player[Main.myPlayer].position.X += 5;
            }
            if (Main.keyState.IsKeyDown(Keys.Up))
            {
                //Main.player[Main.myPlayer].jumpAgain = true;
                Main.player[Main.myPlayer].position.Y -= 10;
            }    

Clone this wiki locally