/CrossyRoady

Đồ án Lập Trình Hướng Đối Tượng , hướng dẫn: Trương Toàn Thịnh

Primary LanguageC++MIT LicenseMIT

Idea

gameing ![ASD](https://github.com/thng292/CrossyRoady/assets/62800118/08eb14c7-95ca-495f-a25e-f6c792baf8b1)

Note:

  • Story (progress):

    • Hidden experience system. Sum of player's score. Passing a threshold -> unlock new map and character
    • At first only one map is available -> grind to unlock more
    • After unlock map, play it through a certain threshold will unlock new character.
    • Should have some thing to indicate that the map's character is unlocked or not
  • Gameplay:

    • The player can only unlock a character if choose the character's map (random mode does not count)
    • The new character is spawn at safe place and unlock by interact with them. Should show a quick dialouge.
    • If the player choose a specific map to play, they only play on that map
    • Random mode will choose a random map. After reach a certain score threshold, the map will change (Stage up).
    • A counter should be present on the screen.
    • The character's skill can be used when the "power bar" is filled up, in order to fill it up the player must progresses through the map.
  • Sprite size (same for hitbox) (1 = 16px):

    • Character: w = 2, h = 2.5
    • Mob: w = 2, h = 2
    • Item: w = 2, h = 2
  • Palette (max 16):

    • Character selection: 10 character, 2 bacgkround, 1 ui, 2 black and white, 1 gray (hsv(0, 0, 30)).
    • Single player: 6 character, 7 map, 2 black and white, 1 shadow.
    • Character info: null.
    • Map selection: null.
    • Settings: null
    • Two player: null.
    • Credits: null
  • Impl:

    • All game object should be condensed (i.e. Store only position, direction, speed). Use struct for this.
    • All game object that use the same Sprite/AniSprie should share the same class instance

How to use spritegen

Demo

Demo Video

Usage

Accepted format: png, jpeg, jpg, gif

Usage: spritegen <filename> [options]
Options:
  -o <filename>   Output filename
  -l              Watch for changes
  -w <width>      Width of the sprite
  -h <height>     Height of the sprite
  -a <algorithm>  Algorithm to use for resizing
                  NearestNeighbor, Bilinear, Bicubic(default), MitchellNetravali, Lanczos2, Lanczos3

How to use live preview

  • Save your image in spritegen folder
  • Run this command .\spritegen.exe <name> -o out.sprite -h 50 -l, replace the <name> with your file name
  • Start TestingGround project
  • The preview will reload everytime you save.

Aserpite

Download link: https://drive.google.com/file/d/1NZjfj_aMfF7UfCMYaBuyLuvjbl3pnlSJ/view?usp=sharing

File formats

sprite

attr size note
width 2 bytes Bigendian, unsigned
height 2 bytes Bigendian, unsigned
data width * height bytes image data as color enum

palette

attr size note
data 16*3=48 bytes 16 RGB color. Use 8 byte for R,G,B. Or

anisprite

attr size note
width 2 bytes Bigendian, unsigned
height 2 bytes Bigendian, unsigned
totalFrame 4 bytes Bigendian, unsigned
fps 1 byte frame per sec
data width * height * totalFrame bytes video data as color enum

color enum

enum class Color : char {
    BLACK = 0,
    BLUE = 1,
    GREEN = 2,
    CYAN = 3,
    RED = 4,
    MAGENTA = 5,
    YELLOW = 6,
    WHITE = 7,
    GRAY = 8,
    LIGHT_BLUE = 9,
    LIGHT_GREEN = 10,
    LIGHT_CYAN = 11,
    LIGHT_RED = 12,
    LIGHT_MAGENTA = 13,
    LIGHT_YELLOW = 14,
    BRIGHT_WHITE = 15,
    // Excluded from color palette. Only use in sprite
    C_TRANSPARENT = 0b11111
};