Git Product home page Git Product logo

asciiroguelike's Introduction

ASCII roguelike

1. Load the levels from files like level1.txt, level2.txt etc.

2. W S A D can be used to move the player.
	For this, we'll use getch() or _getch() which is in conio.h
	It grabs the character typed without us having to press enter.

3. We can refresh our screen by printing a lot of newlines,
	so that older part of the output moves up.
	We can do this by creating a string of 100 newlines and printing it.
	Hence, cout << string(100, '\n'); will do our job.

4. Have some enemies that randomly move around and allow the player to attack them.

5. Make sure the player can't walk through walls.

(Optional ahead - )

6. Can save the game and load it again.

7. Add items and money and an item shop.

8. Allow the player to level up when he gets experience.

9. Have multiple levels.




# for walls
  for air
@ for plater
letters for monsters




We'll store our level as a vector of strings.
vector<string> leveldata
Now, leveldata[i][j] will give us the char at i,j position.

We'll use ifstream to load our level from a txt file.
getline one at a time, store it in a string, push back the string to a vector.
Do that until the file is empty.

To move a player/monster,
we check what char is there where he wants to move.
If it's air, let him move.
If it's wall, don't.
If it's monster/player, start combat.

Surround your level with walls to avoid player walking off the edge.
This will stop access violation, such as -1 in an array/string.

Create a Monster class and store the monsters in a vector<Monster>.
Give them some AI to move around and to attack the player if he's nearby.

asciiroguelike's People

Contributors

heizaman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.