Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!






Ready, Action!

Posted by Truerror, 08 May 2014 · 367 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:





Twitter

April 2015 »

S M T W T F S
   1234
567891011
12131415161718
19202122232425
26 27282930  

Recent Entries

Recent Comments

PARTNERS