Im supose to use <>bool removeTile(char, int, int, char[])<> to do this "function that takes in the choice (D or S) and the two dice numbers and the board as input arguments. When the move is legal and the tile is available for removal, it removes the tile according to the choice by marking the tile as ‘X’. Returns true if the move is successful."
I am creating a 2d tile map game currently and I am trying to find a moderate way of saving and loading it through a text file and fstream.h. I am doing the saving by integers as well. What is difficult for me to understand is how integers save and load. Per line perhaps? I am just not sure about this.
how to replace tiles within a map. My map data is in a .map file and I'm wondering how I can manipulate it to change the tiles.For example, If i kill an enemy, I would want his sprite to go away. I need to know how to do this. I also need to know how to have collisions work. At the moment I have a system where it checks if the tile in a certain direction (based on whatever arrow-key I press) is a certain tile by using its variable name TILE_TILENAME. I'm likely not doing this right, as collisions do not work, but the game still runs fine.
Here is some of my code;
//The tile class Tile { private: //The attributes of the tile
I have been writing a fairly simple turn based rpg game in c++ and at the moment it has a 2d integer array for the map, which I can display using periods for the blank areas and letters for the various people in the game, and I am trying to figure out how to upgrade to a tile based display.
I'm still working on my Project and the next Problem has occured: How do I detect collisions on a tilebased map? My tiles are 16x16 and the map is based on the tutorial of [URL] ..... I really like this Approach because I can define for each tile of what type it should be (so a earth tile can be walkable and lead to a secret passage).
The first Number stands for what Kind of tile it should be (e.g. Grass, Earth, Water, Blank,...) and the number after ":" stands for the type of the tile (e.g. solid, walkable, do dmg to the Player,...).
e.g. 0:0 0:0 0:0 0:0 0:0 //No tile and walkable 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 1:1 1:1 1:1 1:1 1:1 //Grass tile and solid 2:1 2:1 2:1 2:1 2:1 //Earth tile and solid
It's working just fine with loading the Images, but i've got no clue about the collision. I've already read a lot of stuff on the Internet but I don't get how to Combine it the structure from above. For example lazyfoo describes the collision with one object like one wall. So how can I check the Player Position with each tile?
For now there's no camera, but I plan to implement one later...
Basically I have an tile class with the following variables: x, y, texture, and solid. I have created an array called tile MAP[map_tiles_x][map_tiles_y]. The object of the following snip-it of code is to loop through all of the tiles in the map placing their default values in each. For some reason this code does not work as planned, but in theory shouldn't it? I cannot see why it doesn't work. (BTW I do plan on open sourcing this map editor.
I've populate that will a bunch of 1's and 0's. The 1 represents a wall, and a 0 is dirt.
I'm looking for a way to clean up my blank spaces outside of my walls. Any algorithm I can use to identify these big areas and replace them with a '1'
for (int y = 1; y < map.GetLength(1) - 1; y++) { for (int x = 1; x < map.GetLength(0) - 1; x++) { // Inside here is where I was hoping to archive my work bool draw = true; foreach (Room room in rooms)
[Code] ....
Attached is an example of my output.As you will be able to see, there is a lot of brown. I want to fill the brown with walls, but leave space for a path between the rooms.The 'draw' bool is true when I'm outside of a room, just so I don't start throwing walls inside my room.
Example of what the array would look like (for those who don't know)
I should reduce the number of bitmaps I used in my code. I translated my particle engine into code that could be compiled as plain standard C
Currently, the code has a segmentation fault somewhere that I can't figure out. How it should function is that it takes orders from a queue for new lasers to store the instances in a linked list. It then takes that data and updates its coordinates, one node at a time. The first node should also be the first node to complete its life, so it gets removed, and the list is set to the next node in memory. If there are no more nodes left, a if-statement should catch it and either break the current loop, or wait for more items to be requested. If there are nodes left, the process will continue to remove the first node in the list until there are none left. Obviously this is not quite how it works. When I tested in once in SDL, the laser would update every 5 frames, but wasn't shown constantly, and would crash after the node was to be disposed of. When I initialize with the SDL parachute, it would exit before I event saw the screen. Also, the code I translated to standard C will display that the laser has been updated to the screen, but it never says that it has moved up. It crashes after about 4 printf() statments execute. My debugger has been giving me mixed SIGTRAPS, and "nothing is wrong" output. Here is the code in standard C:
So I tried to make a tile map function to display my map as tiles. I keep getting unresolved external symbol errors, I've included the header file, and used every declaration in it, but to be completely honest this is mostly just a try to see if I could do it, and so far I'm failing. So if you can see why I'm getting the error.
My issue is regardless of which date I input its always defaulting to the values I have set in my constructor in my implementation file in the else statement. So the values always default to 3/15/2006 I think its something to do with the logic in my bool function but I may be incorrect.
header //date.h header #include <iostream> #include <string> using namespace std;
enum DateFormat {numeric, standard, alternative}; const int MIN_YEAR = 1900; const int MAX_YEAR = 2015;
How to get my data from the file and output, but now I am having trouble with my acceleration function. Right now, I have the acceleration function commented out and the output for acceleration at the bottom because if I try to run the program with them in it the program stops working. working with acceleration calculations and then finally outputting that acceleration.
//Program that reads the time and vertical velocity data and then calculates things from it
I am again a bit confused with bool since we have not used them much. I understand it is suppose to return a true or false value that is represented by 0 and 1. so I have these two bool's
cout << "Is this a right triangle: " << t2.isRight() << endl; cout << "is this a Triangle: " << t2.isTriangle() << endl;
and i get this "Is this a right triangle: " 0 "Is this a triangle: " 1
Which i know is correct but I want to replace the 1 and 0 with my own string but the things iv tried tweaking with has not worked.
Also in the file attached has some requirements from my teacher but i was confused at the second last one, --- bool isEqual(Triangle &other) and it says return true if triangles are equal and false if triangles are not.
I dont know if this is just simply if one triangle equals another (however you determine that) or if its for the two bool's, isTriangle() and isRight() or what.