Giter Site home page Giter Site logo

snake's Introduction

Snake

Welcome to Snake, a classic game with a twist! This version introduces challenging elements such as portals and walls, adding a new layer of strategy to the familiar gameplay.

image info

Controls

Keyboard

  • W/A/S/D or up/down/left/right: Control the snake's movement.
  • Space: Resume the game after the failed/success screen.
  • R: Reset the game or create a new level layout.
  • ESC: Pause/resume the game.

Controller

Here, the PS4 controller buttons are used as an example, but other controllers will work as well:

  • DPAD: Control the snake's movement.
  • X: Resume the game after the failed/success screen.
  • โ–ณ: Reset the game or create a new level layout.
  • OPTIONS: Pause/resume the game.

If you encounter issues with controller input, please verify that you have selected the correct controller, ensuring it corresponds to the one initially assigned by your PC.

Build Instructions

Prerequisites

Linux

Following libraries have to be installed and accessible to the current user:

  • xorg (should contain:)
    • libx11
    • libxcursor
    • libxrandr
    • libxinerama
    • libxi

Using premake

This project utilizes Premake as its build system, offering seamless integration with Visual Studio, Clang, and GCC. To set up the project, follow these steps:

Clone the repository

git clone https://github.com/pyvyx/Snake.git
cd Snake

Visual Studio

vendor\premake5.exe vs2022

This should generate a .sln file

Make

Windows:

vendor\premake5.exe gmake2 [cc]

Linux:

vendor/premake5linux gmake2 [cc]

macOS:

vendor/premake5macos gmake2 [cc]

GCC should be the default compiler on Windows and Linux, macOS uses Clang by default, but you can explicitly specify it if you want.
GCC: --cc=gcc
Clang: --cc=clang
There are also other compilers available however building has only been tested with gcc, clang and msvc

Build

make [-j] config=<configuration>

Configurations:

  • debug_x86
  • debug_x64 (default, the same as just using make)
  • release_x86
  • release_x64

macOS:

  • debug_universal (default, the same as just using make)
  • release_universal

-j flag utilises multi-threaded compilation

make help

to get a list of all the available configurations

Additional Information

For more details on Premake options, use the following commands:

Windows:

vendor\premake5.exe --help

Linux:

vendor/premake5linux --help

macOS:

vendor/premake5macos --help

Troubleshooting

If you experience linking errors on Linux, resolve them by adding the necessary libraries to Snake/premake5.lua. Ensure these libraries are added before the last line in the file:

filter {}

For linking errors, use this example:

filter "system:linux"
    links {
        "GL",
        "X11",
        "rt",
        "dl",
        "m"
    }

For missing include directories, use this example:

filter "system:linux"
    links {
        "GL",
        "X11",
        "rt",
        "dl",
        "m"
    }

    includedirs {
        "src/",
        "include/
    }

Make sure to tailor these adjustments to accommodate any specific libraries or directories required for successful compilation on the Linux platform.

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.