Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Player Events and Entering Other Maps, changing once again. XNA

Sign in to follow this  


[s]I have a bit of free time on the bus ride home at night and perhaps this is the best time to get some of the writing down. I did a fair bit of coding over the weekend. It's good to have the free time to do it. It's sometimes difficult working all day and bringing myself to the code that I want to do.

The main things that I got working was doors in the tile editor, proper timing for the watering of crops and linking the crop/entity with the layer 1 tile so that it ca change the tile image if it is watered or not.

The first thing I did was work on the doors. First I tried to make the doors larger than 32x32 and stretch the object in the object later. This didn't work because the method that I use to determine if the player is touching an entity was assuming that the tile is always 32x32. I was debating on changing it to accomodate objects that are larger, but I couldn't think of a time that an object wouldn't be a multiple of 32. So, I figured that if I want an object to span more than 32x32, just copy that object and group them together. I know that this might eventually be a performance hit, but honestly I can't see how unless I have thousands of triggers on the map. This just won't happen with the scope of the current game.

The next issue was the handling of the player states. At the start I just had the player walking and standing. So, when the user wasn't pressing a direction then the player must be standing. If the player was touching a direction then the player is walking.[/s]

I have the source for the HTML5/javascript above if anyone is interested. I will post the source. I changed yet again to XNA. I have went the c++ and SDL route and then the HTML5 route and put together prototypes.

For c++ and SDL it was just the annoyance of moving the prototype to my girlfriend's laptop. I compiled and I had difficulties with relative paths to get to the tilesets etc. I am not trying to fight to develop in a specific language, I want to build a game. So I went to the other end of the spectrum and went to HTML5 maybe it had my answer.

I know that I could have been more humble when writing the draw and update methods while creating the HTML5 prototype. I just didn't care for performance because I thought well, my laptop can handle it, so I did stuff sloppy. I mixed in jQuery for the inventory and popups for the store. I thought since I live in ASP.NET and jQuery at work I could bring that home and enjoy it all the more. I was wrong.

I found the RPG template interesting for XNA. I tried to use it and extend it but it was far too different a game in mechanics to extend. I spent about 4 hours cleaning out all the code that I didn't need or want and then I started loading it with what I currently had from my c++ prototype. I had a sprite moving around the screen and took advantage of the tileengine included and it ran. I don't need to have battles and there is no interacting with map object elements in the template. I just found it a hassle to try to understand the code enough to know that I can delete parts and not use that knowledge anymore. In the end I created a new project and only took what I needed. I took the writers and readers idea and the tileengine (mostly). The rest I decided to write from scratch.

I worked on some 3d projects and simple games and read some books etc. There is always that image of viewport, screen coords vs world etc. I now FULLY understand that. When I was building the tileengine and importing the map when it scrolled there would always be the offset from the player position. If the play crosses a specific X then the map scrolls and the player stands still in the screen coords while the map coords for the player are changing. In the c++ prototype I had one player position and calculated it every time and then when I had to decid on collision it would be screwy and I had to calculate again. Now, I can just send a vector2 from screen to map or the other way around. Every object and tile is map coordinates. So much easier.

With the input from a post in the forum I have the player's inventory including ICollectableObjects. These objects are just items that can be inventory items. They can be tools, or crops. These items can be sent to another object of type ActionableObject which decides what to do with it. If I use a hoe on the tilemanager for example, it will check the area clicked and act accordingly, change that tile to dirt.

I have the inventory working but the HUD isn't implemented. I have to add the textures for the inventory items. There will be the map textures but also there is a inventory texture.
Sign in to follow this  


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!