Show DevBest Little movement script

Status
Not open for further replies.

Adil

DevBest CEO
May 28, 2011
1,278
716
Coded in C#, not really of any use to me. You can find the whole .NET RPG at my website.
PHP:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace ConsoleApplication1
{
    class Movements : Info
    {
        public void Action()
        {

            //This cleans up player after it moves
            Console.SetCursorPosition(x, y);
            Console.Write("  ");
            x = x + xspeed;
            y = y + yspeed;

            //this is the control input from the player
            if (Console.KeyAvailable)
            {
                ConsoleKeyInfo Keyinfo = Console.ReadKey(true);
                switch (Keyinfo.Key)
                {
                    case ConsoleKey.W:
                        y = y - 1;
                        figure = "^.^";
                        break;
                    case ConsoleKey.S:
                        y = y + 1;
                        figure = "v.v";
                        break;
                    case ConsoleKey.A:
                        x = x - 1;
                        figure = "<.<";
                        break;
                    case ConsoleKey.D:
                        x = x + 1;
                        figure = ">.>";
                        break;
                    case ConsoleKey.T:
                        pla.Screen();
                        break;
                }
I wanted to port this to C++, so I could implement it into J++ ;D
Have fun
~Adil
 
Status
Not open for further replies.

Users who are viewing this thread

Top