Coder Social home page Coder Social logo

mamad-1373 / challenge-project-create-methods-in-csharp-main Goto Github PK

View Code? Open in Web Editor NEW

This project forked from klouds27/challenge-project-create-methods-in-csharp-main

2.0 0.0 0.0 95 KB

Food Eater is a simple game developed in C# that runs in the console window. The player can control the character using arrow keys and try to eat food items that randomly appear on the screen. The game provides a fun and interactive experience within the console environment. NOT FINISHED

License: MIT License

C# 100.00%

challenge-project-create-methods-in-csharp-main's Introduction

Challenge-project-Create-methods-in-CSharp

Console Game - Food Eater

This is a simple console-based game called "Food Eater," where the player controls a character represented by different states and tries to eat randomly appearing food items. The goal is to eat as much food as possible by moving the player around the console window. The game includes various features, such as random food generation, different player states, and player movement controls.

Table of Contents

Introduction

Food Eater is a simple game developed in C# that runs in the console window. The player can control the character using arrow keys and try to eat food items that randomly appear on the screen. The game provides a fun and interactive experience within the console environment.

Getting Started

Requirements

To play and run the game, you will need the following:

  • .NET Framework installed on your system.
  • A console window on your operating system (Windows, macOS, or Linux).

Installation

  1. Clone this repository to your local machine.
  2. Navigate to the project directory using the command prompt or terminal.
  3. Build the project using the .NET CLI:
    dotnet build
    
  4. Run the game using the .NET CLI:
    dotnet run
    
  5. The game will start in the console window, and you can begin playing.

How to Play

Controls

  • Use the arrow keys (Up, Down, Left, Right) to move the player character.
  • Press the Escape key to exit the game.

Player States

The player character can be in three different states:

  1. Happy: Represented by the character ('-'). The default state of the player when the game starts.
  2. Excited: Represented by the character ('^-^'). When the player eats certain food, it becomes faster and changes to this state.
  3. Sick: Represented by the character ('(X_X)'). If the player eats specific food, it becomes sick and freezes for a short time.

Food

  • The game displays various food items represented by strings such as @@@@@, $$$$$, and #####.
  • The player needs to move over the food items to eat them and change their appearance.

Game Mechanics

  • The game starts with the player character in its default "Happy" state.
  • The food items appear at random positions on the console window.
  • As the player character moves over the food items, it consumes them.
  • Consuming different types of food changes the appearance and behavior of the player character.
  • Eating specific food items can make the player character faster or make it freeze temporarily.
  • The game continues until the player decides to exit or the console window is resized.

Documentation

This project's code is documented using inline comments, which provide a detailed explanation of the code's functionality and logic. The following are the main functions and their purposes:

  1. TerminalResized(): Checks if the console window has been resized.
  2. ShowFood(): Displays random food at a random location on the console.
  3. GotFood(): Checks if the player character has eaten the food.
  4. PlayerIsSick(): Checks if the player character is in a sick state.
  5. PlayerIsFaster(): Checks if the player character is in an excited (faster) state.
  6. ChangePlayer(): Updates the player character appearance based on the consumed food.
  7. FreezePlayer(): Temporarily stops the player character from moving.
  8. Move(int speed, bool otherKeysExit): Reads directional input from the console and moves the player character.
  9. InitializeGame(): Clears the console, displays the food, and places the player character at the starting position.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

challenge-project-create-methods-in-csharp-main's People

Contributors

klouds27 avatar

Stargazers

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