Giter Club home page Giter Club logo

cat-o-licious's Introduction

cat-o-licious

This is a simple cat game written in Go, inspired by flappy. My kids were too excited to see flappy's source code and wanted to design and code their own game, so that's what we did together in a rainy Sunday.

The original version uses SDL (like flappy) and works on MacOS, Linux and Windows.

In the wasm directory there's an experimental version in WebAssembly. Most of the code is copied from the SDL version, except for the media handling parts and lack of audio. This allow kids to play the game in a web browser.

Try playing in browser now!

cat-o-licious

Install

If you're not here for the code, and just want to play, you can download binary releases from https://github.com/fiorix/cat-o-licious/releases/.

Keys

Arrows left and right, as well as A and D for lateral movement. F for full screen, and Q to quit.

Playing

You're the cat, and food falls from the top of the screen. The more good stuff you lick the more points you make. The more points you make the more food drops, and it gets really hard to get out of the way of the broccoli, tomatos and pineapples.

My kids love veggies btw, but they say that cats don't.

Building from source

Tested on MacOS, Linux, and Windows. Requires cgo.

Install go-sdl2 bindings:

go get -v -d github.com/veandco/go-sdl2/{sdl,img,mix,ttf}

More information on go-sdl2. go-sdl2 ships with static SDL2 in .go-sdl2-libs/ so you don't have to install SDL for your OS.

Get the code, build static binary:

go get -v -d github.com/fiorix/cat-o-licious
cd $GOPATH/src/github.com/fiorix/cat-o-licious
go build -v -tags static

The assets directory must be relative to the path of the binary. Assets include fonts, images, and sounds used by the game. The font was copied from flappy, images randomly downloaded from the Internet, and the game soundtrack is my daughter's composition in Garage Band. Go figure.

Run:

./cat-o-licious

There's a minimal set of command line flags for things like screen resolution, player speed, and FPS.

WebAssembly

This version has no external dependencies, but requires a web server.

cd wasm
make

Then use a web server to serve the wasm directory and point your browser there.

For local test/dev you can use server.go in the wasm directory.

cat-o-licious's People

Contributors

fiorix avatar gonzaloserrano avatar

Watchers

James Cloos 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.