C++ :: Making Arrays For Equipping Weapons In Simple RPG Game
Feb 26, 2014
I have a sword(25 damage), spear(20 damage), arrow(15 damage), dagger(10 damage) and knife(5 damage). I want to make a class for them so that I can equip one of them in battle and use them to inflict damage.
I'm trying to make a very simple game in SFML, and i have a problem. Whenever i try to create sf::Sprite for the class where all properties of Player (his sprite, health, speed, etc.) It gives me error.
#include <sfml.h> #include <list> class Playerclass{ public: int xspeed, yspeed; float health; sf::Sprite entsprite();
[Code] ....
The error is with player.entsprite.setTexture(texture) : "'player.Playerclass::entsprite' does not have class type".
I wish to create a simple animation, similar to the pong game but completely automatic (i.e. both sides play against eachother sort of like in a screensaver of sorts).
I am clueless on to even start tackling this, what tools to use and how to use them, to make them do what I want. I have had some experience with C++ scripting while modding Fallout 3, but I'm not sure how similar the scripting system available in the SDK for that game, is to the real thing.
Like I was saying I want to create a simple animation where two AI blocks try to prevent a ball from reaching the wall behind them.
Here's my game, what do I need to learn to make a basic GUI? (Easiest way possible for now).
--NOTE, the code was a bit too long for me to post. I can add it if it is necessary. Basically all I want are 4 buttons on the main screen, one that says "Arena," "Store," "Stats," and "Exit."
There will of course be sub menus to each option, but we will get to that later.
I am making an open world RPG game. I have already done the graphics rendering (with directx 11 on windows 8). I am a bit confused of how to load all of this data in, and I looked into how the game Skyrim did it. I didn't find much information about it at all, apart from it uses cells for each bit of the game, and if you character were to kick a pumpkin (for example) it would record the new location in the player's save file. The same goes for spells, perks, quests, etc.
My problem is, I'm not sure how to implement something similar in code!
i am making a space game using sfml 2.0. i want it to move depending on its rotation. so if it is rotated 20 degrees it move in the direction it is facing. how do you do it?
Making/Building 3D Game Engines, Do I need to know anything related to ART or graphics in order to make them ? I mean, I do know that having a know how about vectors is VERY important, But I am no good at art, I suck. I have thought of getting a separate guy to do the art, as I'm more interested in writing code and then implementing it making use of the art that has been made, I'm just worried if I need to or not need to know anything about sketching or art in order to write a 3D Game engine ?
when it comes to programming. I was trying to make a simple letter guessing game where the user has 6 chances to guess the letter V. The command prompt works fine until the user enters 'y' to play. It repeats my HIGH & LOW statements twice before letting me guess again. It's all a mess.
I've been in the process of making a simple ascii game and worked out to make random terrain that wasn't all that bad (but has some flaws and is not very efficient). I came across midpoint displacement and the diamond square algorithms and was blown away by the results that come from using them. So I decided to try implementing one into my game but I'm having a really hard time coding it out. I have read a whole bunch on them but haven't really found any good tutorials that breaks it down into steps with sample code. I just need it stored in an array I can handle graphics and output.
ex: 5x5 array with all starting corners being 9 in height
I am trying to get this to work without arrays. At the moment all I am trying to do is allow it so that when the user presses 1 the board prints with 1 replaced by X, tell me where am i going wrong. I know its not finished.
#include <stdio.h> #include <stdbool.h> char a = '1'; char b = '2'; char c = '3';
I am making a simple arkanoid game. When the ball hits the block, i want the block to disappear. How would i go around this? i am working in visual studio. I got the collision and everything working.. Here is my code;
int main(int argc, char** argv){
//initialisation SDL_Init(SDL_INIT_EVERYTHING); SDL_WM_SetCaption("Graphics Window",NULL); //set name of project
I am trying to draw a grid for checkers. I could draw a square at the starting point from origin with the code below(attached the pic below how it looks) however I am not being able to draw a grid when the program runs.
#include "ccc_win.h" // GameDemo.cpp // Shows how to place a piece accurately on a grid after a mouse click. #include "ccc_win.h" // for graphics classes and functions using namespace std; int ccc_win_main(void) // main function for graphics program
I'm trying to write a code that proves a queue like fifo (first in first out). I have four characters :
p(rint),e(nqueue),d(equeue) and q(uit).
The problem is when I press d a first character must get rid of, but not. When I press d the numbers get double.
Example input: e 2 3 9 8 7 p 2 3 9 8 7 d p 3 9 8 7 d p 9 8 7
#include <stdio.h> void enqueue(int queue[], int newnum, int *tail_p, int maxsize); void deque(int queue[], int *tail_p, int *elem); void printqueue(int queue[],int count);
I have to write a program that simulates a handheld gaming system. a system can have power toggled so its either on or off. when the system is on, its volume level can be raised or lowerd. a system has minimum volume level of zero and a maximum volume level of 10. a system stores games.
// simple game menu //simulates a handheld gaming system using namespace std; class Game { public: Game(int GameNumber = 3, int volume = 10);
I'm trying to make a simple snake game in C# using 2 Dimensional Arrays . I have a grid of labels. I am having problems with differentiating the head of the snake from the rest of it's body. Also I need generating 2 random numbers and filling them inside my array.
I don't know how to place random food on my array. This is because the food can't be placed on the location of the snake. Which brings me to my other problem which is keeping track of the snake and updating it. I don't know what structure to use and How to actually do the above methods. I've tried looking at a lot of sample snake projects but they don't have arrays in them.
Objective : Code a game allowing two human players to play tictactoe.
Create 2 classes: -Create a 3 x 3, 2-D array board class to play the game. -Player; has a private string name data member and a method that reads the players’ row and column selections from the keyboard.
Create 2 player objects from this class. Name the players Orestes and Xerxes.
Think carefully about board and player classes responsibilities and how they interaction with one another. The players do not collaborate with one another but they collaborate with the board.
My Problem : The program compiles with the header file, but it the displaying is wrong as you will see when you enter your row and column.
Sources Header file:
Code: #include <iostream> #include <string> using namespace std; class Board { public: void display(char Z[][3], int row, int col);
I have been coding a while on a 2D random terrain game. How would I go about saving the maps? I have an array for blocks, lighting, background and background lighting. The lighting is done in real-time, so exclude that.
But with two 32000x3200 arrays, I still need to store 204800000 separate numbers in a file. Oh god. How can I have this? I could write down the separate numbers, but...yeah.
I'm supposed to create a "game" that is similar to Candy Crush or Bejeweled. The assignment takes in a .txt file that contains a matrix of values from 1-5 and then assigns each value to a spot in a [10][10] array. Then an Escape Code function prints out colored pixels in place of the number values for each spot, creating a "game board" looking output. Finally, the program is supposed to look for any matches of 3 same-colored pixels and replace them with a white pixel and "XX". Then the program prints the corrected game board with the matches X'd out.
I have it mostly coded, but I've encountered a couple of issues.
1.) I am supposed to label the columns and rows 0-9, and while I have no problem coding the labels for the columns using printf( ), when I try to print the row labels I get a random string of numbers.
2.) I replaced the matches with white pixels by reassigning the value in the array to 7, for which the ANSI Escape Code is white. However, I'm unsure about how to print the "XX" in the same spot.
Here is the input(.txt) file and the output of the program so far:
And here is what I have coded at this point:
Code: #include <stdio.h> void printEscapeCode(int c); int main(void) { /* Declare an image array to be gameboard */ int gameboard[10][10]; /* Declare variables and load in how many rows and columns */ int Nrows; Nrows = 0;
My assignment is writing Madd Libs game. I still do not understand how to store inputted strings or values to arrays. I need explanation of collecting inputted data to arrays.