C++ :: Simple ASCII Game - Fractal Terrain
Jan 31, 2013
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
98679
87658
76557
88789
98889
^^Something simple like that.
View 1 Replies
ADVERTISEMENT
Oct 2, 2013
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.
View 2 Replies
View Related
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.
View 1 Replies
View Related
Mar 24, 2015
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
//variable declaration
SDL_Surface*screen;
boolrunning;
intgameState;
float startTime;
[Code] ....
View 1 Replies
View Related
Oct 7, 2014
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
[Code] ....
View 3 Replies
View Related
Jul 20, 2013
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".
View 2 Replies
View Related
Oct 24, 2013
I am required to create a simple candy crush game.
I am this stage where I am required to print the 'box' for navigation purpose at the center of the board once the program initializes.
Here is the code:
Code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
//FUNCTION: Draw the Board
[Code].....
I understand that the sequence could be to clear the screen and print the whole board with the indicated marker.
*Yes I am required to move the box in later part of the program but for now, I just need to get the box to show up at coordinate
Code: board[5][5]
I am stuck ...
View 11 Replies
View Related
Sep 26, 2013
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);
[Code] .....
View 1 Replies
View Related
Apr 11, 2013
I'm trying to zoom into a fractal and to do this I'm using mouse click to calculate where the centre should be and then taking away 1 from the right and top and adding 1 to the left and bottom to make a zoomed in version. This works perfectly... for 15 zooms. When the value of the left and right meet each other the fractal starts zooming out instead of in. Through multiplication maybe?
View 3 Replies
View Related
Mar 27, 2014
The following function finds the normal to a terrain represented by a texture. I found it somewhere online , it works but i couldn't understand the math behind it. So , How (or Why ?) does it works ?
//psuedo code
Vector2 normal(x,y) {
Vector2 avg;
for(int w = -3; w <= 3; w++) {
for(int h = -3; h <= 3; h++)
[Code] ....
View 6 Replies
View Related
Apr 17, 2014
Okay I'm trying to calculate vertex normals for my terrain mesh. Obviously it's not working, but I can't work out why. Either its the way I calculate the normals, or the way I assign the final normal.
line 416 is where the normals are assigned to each point in my mesh. line 735 is the function for normals
class Normal3d {
private:
double x;
double y;
double z;
public:
Normal3d(double nx, double ny, double nz) : x(nx), y(ny), z(nz) {
}
Normal3d() {};
[Code]...
View 6 Replies
View Related
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
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
Feb 26, 2014
How do I print this without generating errors?
Code:
printf(" ||====================================================================||
");
printf(" ||//$///////////////////////////////$||
");
printf(" ||(100)==================| RESERVE BANK OF INDIA|================(100)||
");
printf(" ||$// ~ '------========--------' $//||
[code].....
View 8 Replies
View Related
May 7, 2013
I want to convert Hex:390041 to ascii "90A",
39: 9
00: 0 -->Null
41: A
i am getting only "9" in the bytearray,i know 0 is terminating the array
unsigned int bytes[3];
int j=0,counter=0;
char c[2];
[Code]....
View 1 Replies
View Related
Mar 31, 2015
I have some ascii characters in a char variable.ex - char buf[100]="ab*(z&";
So each of the char in that char array will have some hex value.ex- *'s hex value is '2a'.
And I have a long long int variable in which there is a 64 bit hex value.
ex- long long int k=0x0000888888888888;
Now i want to subtract the char buff's hex value in k. How to accomplish it.
That is 0x0000888888888888
- 0x000061622a287a26
= 0x000027265e600e62 (final result in a buffer or a long variable is okay)
Later i want to reverse the result as 26e006e56272.It should be stored in a variable such that i should be able to access each byte from it(ex- '72'(last 2 hex digits))
View 1 Replies
View Related
Aug 25, 2013
I know how to find find ASCII value of given character, but I am not getting how to find ASCII value of given string. For example I want to find ASCII value of string "HELLO",so how to do that.
View 13 Replies
View Related
Mar 4, 2013
how can I find ASCII value (0..255) of a character char in a string?
I have an array of char:
Code: char myarray[50]; and I need to have ASCII value of character eg myarray[10]. How can I do that?
View 1 Replies
View Related
Mar 15, 2015
I have to Write a program to produce that makes four triangles and a pyramid. I have to ask the user they height of the triangle and prevent the user from entering a height any larger than 25. It should look like this.
Enter the height of your triangle/pyramid: 3
***
**
*
*
**
***
*
**
***
***
**
*
*
***
*****
im having tourble with 3 and 4th and also pyramid.
HERES WHAT I HAVE SO FAR.
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main () {
int input = 0;
cout << "Please enter the height of your triangle/pyramid: ";
[Code] .....
View 2 Replies
View Related
Jan 26, 2011
I'm currently working on a project that utilitzes a Caesar Cipher. Basically, it reads input from a file and then, depending upon the input file, requires encrypting or decrypting. The cipher used to encrypt/decrypt simply adds/subtracts an integer from each character in the input file. All input is lowercase alphabetic characters (ASCII 97-122). My problem is trying to figure out how to wrap the ciphered characters, e.g., if the cipher require a shift of +5 and the character read was 'x', a shift of +5 to the right would produce 'c' (beginning with 'x' and counting up 5 letters: 'y', 'z', 'a', 'b', 'c').
I've written some crude and cumbersome loops that will work, but there has to be a better way. It is my understanding that it can be done using the modulus operation, %, but I cannot figure out how. I spent several hours trying to figure out the modulus approach, but no luck.
View 6 Replies
View Related
Feb 7, 2014
How can I convert bytes to ASCII?, I read wikipedia about UTF-8 and I understood a little bit about add or split bytes to change the value.
Now I have those bytes
0xC7 0xE6 0xC2 0x91 0x93 0x7B 0xCE 0x01
And I found a program (DCode) that convert to 64 bits little-endian, supposedly those bytes in ASCII is this.
lun, 08 julio 2013 04:28:17 UTC <---
View 3 Replies
View Related
Apr 6, 2014
I have a C program where I rapprendentare a table using a 10x10 matrix and create the chart with the game piece and the matrix in a spiral. I do not know how to start or even how to create the table with the ascii codes. is a task for school and I need to do it soon.
View 1 Replies
View Related
May 24, 2013
for an assignment we need to create basically a program that asks the user for the result of standard six-sided die rolls (numbers from 1 to 6). The program will prompt the user with "Enter a die roll or 0 to exit " for the first entry and Next die roll? for all subsequent entries. The program will continue reading die rolls from the user until the user enters 0. At this point, the program prints two newline characters (one blank line) and finally, the bar chart showing the number of times each die roll has been entered, and then terminates.If the user enters an invalid number, the program will just ignore it, and ask for another number. Only numbers 1-6 inclusive and 0 are valid.
Example output Enter a die roll or 0 to exit 6 Next die roll? 6 Next die roll? 7 Next die roll? 4 Next die roll? 0
[code].....
View 3 Replies
View Related
Nov 7, 2013
I am looking for a way to sort a string just by the alpha characters, not by the ASCII table. Therefore
string sort(string name) {
sort(name.begin(), name.end());
return name;
}
will not work. And I am looking for the most simple way to go about it!
View 7 Replies
View Related
Jan 26, 2014
I am making a text encrypter and I have to convert text into ASCII codes. I know how to convert a single character into ASCII -
#include <iostream>
using namespace std;
int main() {
cout<<"Text to ASCII converter"<<endl<<"Enter text to convert into ASCII - ";
char text; //defining input type, which is single character
[Code] ....
Try it here - URL.....Is there any way to run a similar program, which converts a string with spaces into ASCII code?
View 1 Replies
View Related
Jan 7, 2014
How to give input with text for this function.i already create function for this but i dn't know give input as non ASCII value(0-32) that Cobain with string or simple text.
View 1 Replies
View Related