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

Entries in this blog


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

[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.




Farming Game

After switching from XNA to OpenGL (C++) to Android (OpenGL), to SDL and finally now to SDL OpengGL (c++) I am sticking to the guns and trying to actually code this game.

What's even funnier yet not as funny is the fact that between the first draft and adding to this I have switched to another game. Instead of the card game that I was working on in c++ opengl and SDL I am not working on a farming type of game like harvest moon. Currently I have the graphics rendering the maps and I can edit the map(s) with Tiled which I am parsing into the engine using tinyxml. I have the sprite moving around, you can plant crops and they will grow depending on whether you have watered them. There is currently no way of determining that you have watered them except for that they continue to grow.

The crops aren't based on a tile, they are in an object layer which when you edit in Tiled I have to set the Type attribute to the crop name and then set the grow percentage which will tell how far along the crop is and will load accordingly. This is all done very sloppy right now, it IS loading, but there is very little error checking.

Ah yes, there is a layer overtop of everything that handles the time of day. Right now I am trying to determine how I am going to link the tile layer with the object layer so that I can check whether you can plant a crop on the selected tile given that the tile is a dirt tile. I reckon that I will do a bit of work this weekend on it and try to get a few screen shots.



Sign in to follow this  
  • Advertisement
  • Advertisement
  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!