Jump to content
Sign in to follow this  
  • entries
    5
  • comments
    17
  • views
    5584

Ready, Action!

Sign in to follow this  
Truerror

1029 views

Ok, so it's been a while since my last post. Since then, I've revamped the code, especially the movement code, added game states, and now, I've added a simple action menu which pops up everytimes a unit is selected.

My game state implementation is a very simple one. I simply created a class for each type of game state. So I added a Level.cs and refactored most of the codes in my main Game1.cs into it. I also made a Menu.cs for the various menus I might implement. The Game1.cs now only consists of (mainly) switch states to switch from one state to another.

I also revamped the entire movement code so that the game objects now move one tile each frame. It's not only faster, but it also enables me to keep track of how many tiles they pass through, which will be useful when I start implementing the movement point system later. The GameObject.cs therefore now contains a total of 5 move-related methods. MoveUp(), MoveDown(), MoveLeft(), and MoveRight() are all privates. Move() is public, and it calls the first 4 methods as needed.

The last change is the action menu. Right now I have 3 options there, but only the 'Move' option is implemented. The action menu pops up slightly to the right of the selected unit, and is handled by the unit itself. It's working now, but if the unit is located at the right edge of the map, then the menu appears outside of the map boundaries. I haven't coded the special offsets for these situations yet.

Here's how it looks right now:
[media]
[/media]
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!