C++ :: Tile Based Game Display

Apr 10, 2013

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.

View 3 Replies


ADVERTISEMENT

C++ :: SDL - Tile Based Collision Detection

Oct 14, 2014

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

I'm trying to make a 2D platformer

View 5 Replies View Related

C++ :: Tile Based RPG - Undefined Reference To Class Function

Mar 13, 2014

I'm making a simple tile-based RPG and I've run into a bit of trouble when I put my code into classes.

Heres my main

#include <iostream>
#include "windows.h"
#include "math.h"
#include "time.h"
#include <string>
#include "Goblin.h"
#include "User.h"
#include "Inventory.h"
#include "Maps.h"
using namespace std;
void treasureGet();

[Code] ....

My other 3 classes have the same structure and the same error for all their functions.

This is the exact Error

undefined reference to `Goblin::goblinBattle()'|
undefined reference to `Goblin::goblinBattle()'|
undefined reference to `Goblin::goblinBattle()'|
undefined reference to `Goblin::goblinBattle()'|
undefined reference to `Inventory::inventoryOpen()'|
undefined reference to `Goblin::Goblin()'|
undefined reference to `User::User()'|
undefined reference to `Inventory::Inventory()'|
undefined reference to `Maps::Maps()'|
||=== Build finished: 9 errors, 29 warnings (0 minutes, 0 seconds) ===|

View 4 Replies View Related

C++ :: Tile Mapping Program - Loop Through All Tiles In Game Setting X And Y Coordinates

Jun 6, 2013

void create_map(){

int x = 0;
int y = 0;
while (y >= 15) {
game_map[x][y].pos_x = x * tile_size;
game_map[x][y].pos_y = y * tile_size;

Objective of the code: to loop through all tiles in the game, setting their X and Y coordinates.

It just doesn't do anything at all. No error message.

View 12 Replies View Related

C/C++ :: Creating Two Dimensional Terminal Based Game?

Apr 4, 2014

i am working on class project in which i have to save the tank from canon....imy tank is moving only when i press the moving key.. and after that i see blank screen what should i do to run my process when i am not pressing moving keys....

View 8 Replies View Related

C++ :: How To Create Text Based Game Running On Console

Mar 12, 2013

I want to create a text-based game with C++, running on the console. I have made some other text-based console games.

Which is the most interesting text-based game to learn how to program for beginners?

View 2 Replies View Related

C++ :: Turn Based Game - How To Make It Cross Platform

Sep 12, 2014

I am starting a turn based battle (similar to pokemon) app. How could i make this and make it cross platform. Also is it possible to make it access gps and allow other devices with the same app communicate with each other?

I have done things on the command line but i never made anything with images so i dont even know where to start for this app.

View 4 Replies View Related

C++ :: Text Based RPG Game - Saving Integers And Strings

Jul 14, 2013

I am working on a text-based RPG game and I want to allow the player to save his progress. So I need to save several integers and a string. And my problem starts here "How can I save integers and load them?". I read the tutorial but I dont understand. I need to write a function to save game?

View 8 Replies View Related

C/C++ :: Text Based Game - Adding Players Names?

Mar 28, 2015

I am trying to make a very simple text based game and I want the players to be able to name their characters. Thus, I am trying to have the game ask "how many players will be playing:" and then taking that number (X) and create a place to store that information. I'm trying to get the game to ask, "What is the name of Player1?" Then once the user enters the name it would ask "What is the name of Player2" and that cycle would continue until PlayerX has entered their name. Is what I am doing close?

Here are the errors:

error C2143: syntax error : missing ';' before 'string'(ln 29 col 1)
Error2error C2678: binary '<<' : no operator found which takes a left-hand operand of type 'std::basic_istream<char,std::char_traits<char>>' (or there is no acceptable conversion) (ln 30 col 1)

int NumberOfPlayers;
if (Response1 == "Yes") {
cout << "
How many players will be joining us on our adventure: ";

[Code].....

View 9 Replies View Related

C# :: Display Data In Text Box Based On ID

Dec 23, 2014

I have a area in my Project where i need to display a title and content in two text boxes. The Data base tables are:

ID | Title | Content

This is what I have so far, I know I am on the right track, I just cant figure out how to get each box to display based on the ID.

private void frmMain_Load(object sender, EventArgs e){
try {
string connStr = ConfigurationManager.ConnectionStrings["sdcAssistDB"].ConnectionString;
OleDbConnection dbConn = new OleDbConnection(connStr);
dbConn.Open();

[Code] ....

View 3 Replies View Related

C++ :: Two Player Strategic Battle Turn Based Game - Assigning Controls

Nov 1, 2014

I am making a game which is a two player strategic battle turn based game..... The game will require each player to choose a attack. What would be the best key configuration for set of four attack. Like

player 1: 1,2,3,4;
player 2: 7,8,9,0;
where 1&7 are for kick 2&8 are for punch etc.....
or
player 1: q,w,e,r;
player 2: u,i,o,p;

View 2 Replies View Related

C++ :: Display All The Contents Of A File Excluding One Based On User Input

Mar 10, 2014

i want to display all the contents of a file excluding one based on user input say i have 4 records in the file numbered 1 to 4....the user chooses 2 to exclude it outputs records 1,3,4,4 when it should be records 1,3,4 what am i doing wrong here is the code.its basically displaying the last record in the file twice

void excludeRecord()
{
ifstream read;
read.open("Data.txt");
int recordC =0;
string fnameC = " ";
string lnameC = " ";

[Code]...

View 2 Replies View Related

C++ :: Display Fraction In Proper From Based On 2 Arguments Passed To Class Member Function

Mar 15, 2015

We're assigned a project working with classes and fractions. My goal is to display a fraction in proper from based on 2 arguments passed to a class member function proper();

My strategy was to utilize the greatest common factor between the 2 arguements, then divide both the numerator and denominator by that number and then it would display.

The program actually runs, but only seems to divide the numerator and not the denominator. This in return makes my other class member functions have incorrect comparisons and sums.

Code:
#include<iostream>
#include<conio.h>
class Fraction {
friend void compare(Fraction a, Fraction b);
friend void sum(Fraction a, Fraction b);

[Code] ....

View 14 Replies View Related

C++ :: 2-dim Array Display Output For Matching Game

Apr 10, 2014

I am creating a matching game, using US States and a 2-dim array.

As you can see, when the below code runs, some of the grid tiles appear offset, and when selected by pressing spacebar, do not appear.

Here is the .h file:

#include "stdafx.h"
#include <iostream>
#include <cstdlib>

[Code]....

View 3 Replies View Related

C++ :: Video Game Programming - How To Display Graphics And Set Properties

Jun 10, 2013

How would you create a video game in c++? I'm not sure really how to display the graphics and set properties and do all that stuff. I don't have money to buy a book about so how do you?

View 2 Replies View Related

C++ :: Turn Based Game Turn Order?

Feb 14, 2013

How would one cycle through a turn order in a turn-based game? I was thinking an array of every creature (including the player) and have a pointer to the array++ after the turn, but I couldn't put all the objects into an array.

View 2 Replies View Related

C++ :: 2D Tile Map Saver / Loader

Nov 13, 2014

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.

View 3 Replies View Related

C++ :: Tile Replacement And Collisions In SDL

Mar 26, 2014

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

[Code]....

View 1 Replies View Related

C++ :: How To Use Bool Remove Tile

Aug 15, 2014

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

View 4 Replies View Related

C++ :: For Loop Theory For Tile Map Editing Program

Jul 10, 2013

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.

void init_map(){
for (int tile_y; tile_y < map_tiles_y; tile_y++){
for (int tile_x; tile_x < map_tiles_x; tile_x++){
MAP[tile_x][tile_y].x = tile_x * tile_size;
MAP[tile_x][tile_y].y = tile_y * tile_size;
MAP[tile_x][tile_y].solid = false;
std::cout << MAP[tile_x][tile_y].x << ", " << MAP[tile_x][tile_y].y;
} }

I should also add the effect of the code. Basically it only sets the default coordinates for the first object :/.

View 4 Replies View Related

C# :: Clear White Space On Random Tile Map

Mar 14, 2015

I've got myself a 2d array

int[,] map = new int[100,100];

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)

int[,] map = new int[100,100]
{
{0,1,1,1,1,1,0},
{0,1,0,0,0,1,0},
{0,1,0,0,0,1,0},
{0,1,0,0,0,1,0},
{0,1,0,0,0,1,0},
{0,1,1,1,1,1,0},
};

View 6 Replies View Related

C :: Laser Project Tile Engine Doesn't Work

Aug 27, 2013

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:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define MAX_LASER_QUEUE 10
}

[code]....

View 6 Replies View Related

C++ :: Tile Map (unknown Reason For Unresolved External Symbols)

Nov 7, 2013

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.

header tileMap.h:

#include<SFML/Graphics.hpp>
#include<iostream>
#include<fstream>
#include<string>
#include<cctype>
#include<vector>

class tileMap{

[Code] .....

output message:
1234567891011121314
1
1> main.cpp
1>c:users wiggystardustdocumentsvisual studio 2010projects ilemapenginemain.cpp(21): warning C4018: '<' : signed/unsigned mismatch

[Code] ....

View 8 Replies View Related

C++ :: Game Design Practice For Accessing Container Of Game Objects

Dec 21, 2014

I'm working on my first video game. So far I have a few classes in the game starting with the Game class which includes a list of GameObjects (another class). There are several classes that inherit from GameObjects used to implement things like bullets, explosions, various enemy types, etc.

The game essentially iterates through the list of GameObjects to update/render them. I would like to provide access to the Game's list of GameObjects inside another class (like the Bullet class) so I can put new objects on the list. For example, when a bullet hits, I want to add an explosion to the Game's GameObject list it can be updated/rendered.

How this should be setup? I was considering adding a pointer to the Game or GameObject list to the GameObject class (and methods to access it), but I was wondering if there is a better way to set this up?

View 4 Replies View Related

C++ :: Program For Calculating Total Price Of Game Station And Game

Sep 13, 2014

I would like to make a program for calculating the total price of a game station, and a game. I made a program like this for just the price of a game in class, but I want to make one that does the game system as well.

View 7 Replies View Related

C/C++ :: Call To String Function To Display Names In Class Not Display

Apr 19, 2014

I created class called students which suppose to store students names of in array but when I call the display function it display only the first name. but I want it to display names depending on the array size.

#include <iostream>
#include <sstream>
using namespace std;
const int SIZE=5;

[Code]....

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved