Skip to content

Commit

Permalink
added build and usage instructions to the reademe.md fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
skatiyar committed Sep 14, 2018
1 parent 3a7f578 commit d3f4d64
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 12 deletions.
70 changes: 64 additions & 6 deletions README.md
@@ -1,17 +1,75 @@
# pacman
# Pacman

[![Go to game](https://img.shields.io/badge/Try%20Game-Online-green.svg)](https://skatiyar.github.io/pacman)
[![Go Report Card](https://goreportcard.com/badge/github.com/skatiyar/pacman)](https://goreportcard.com/report/github.com/skatiyar/pacman)

Classic pacman with procedurally generated infinite vertical maze, written in Golang.
Classic Pacman with procedurally generated infinite vertical maze.

![Sample](https://raw.githubusercontent.com/skatiyar/pacman/master/pacman.gif)

## Motivation

I came across Eller's algorithm for maze generation, a few months back. Its ability to generate next row with just the knowledge of current row could be used to create an infinite maze.

Since then I have been toying with idea of creating a game around it. It wasn't until a few days ago that I finally decided to use Pacman as the basis for game. I had experimented with [Ebiten](https://github.com/hajimehoshi/ebiten) 2D game engine a bit and this gave me a good opportunity to use it.


## Build

```
Using `go get` & without go modules.

```shell
$ go get -u github.com/skatiyar/pacman
$ cd skatiyar/pacman/build/pacman
$ go run main.go
```
$ cd skatiyar/pacman
$ go get ./...
$ cd build/pacman #goto build dir
$ go build -o pacman main.go
$ ./pacman
```

Using `git clone` & go modules.

```shell
$ git clone https://github.com/skatiyar/pacman.git
$ cd pacman/build/pacman #goto build dir
$ go build -o pacman main.go
$ ./pacman
```

## Build gh-pages

Golang code is converted to JS by using [gopherjs](https://github.com/gopherjs/gopherjs). Ebiten supports browsers by using webgl.

Note: Setup repo beforehand, as shown above.

To build just go code.

```shell
$ go get -u github.com/gopherjs/gopherjs
$ cd pacman/build/pacman
$ gopherjs build --tags=pacman --output=pacman.js
```

To build gh-pages.

```shell
$ go get -u github.com/gopherjs/gopherjs
$ cd pacman/build/pacman-pages
$ yarn install && yarn build
```

## How to play

- Use `arrow keys` to move pacman.
- Gain points by eating `dots`.
- Ghosts try to chase player and on collision player `looses` a life.
- Player starts with 5 lives and can have upto 7.
- Collect `diamond` to increase lives.
- Use `flask` to gain ability to destroy ghosts, ability lasts for `10 Sec` & ghosts try to runaway from player.
- `Eating` a running away ghost gives a bonus of `200 points`.

## Thanks to

- [Hajimehoshi](https://github.com/hajimehoshi) for Ebiten 2D engine.
- [Classic Gaming](http://www.classicgaming.cc) for Pacman & Ghost character-art & sounds.
- [Golang](https://golang.org) community for awesome tools and libraries.
2 changes: 1 addition & 1 deletion build/pacman-pages/dist/pacman.js.map

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions build/pacman-pages/src/index.html
Expand Up @@ -36,14 +36,15 @@
<i class="Icon--blue ArrowDownIcon"></i>
<i class="Icon--red ArrowLeftIcon"></i>
</span>
keys to move pacman. Ghosts try to chase player and
on collision player looses a life.<br /><br />
keys to move pacman. Gain points by eating dots. Ghosts
try to chase player and on collision player looses a life.<br /><br />
Player starts with 5 lives and can have upto 7. Collect
<span class="Diamond"></span>
to increase lives. Use
<span class="Flask"></span>
to gain ability to destroy ghosts, ability lasts for 10 seconds &amp;
ghosts try to runaway from player. Eating a ghost gives bonus of 200 points.
ghosts try to runaway from player. Eating a running away ghost gives
bonus of 200 points.
</p>
</div>
<div class="Footer__Section">
Expand Down
1 change: 0 additions & 1 deletion go.mod
Expand Up @@ -7,7 +7,6 @@ require (
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c // indirect
github.com/hajimehoshi/ebiten v1.7.3
github.com/hajimehoshi/oto v0.1.3 // indirect
github.com/kr/pty v1.1.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.2.2
github.com/theckman/go-flock v0.5.0 // indirect
Expand Down
9 changes: 8 additions & 1 deletion go.sum
Expand Up @@ -10,25 +10,28 @@ github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF0
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/gopherjs/gopherjs v0.0.0-20180628210949-0892b62f0d9f h1:FDM3EtwZLyhW48YRiyqjivNlNZjAObv4xt4NnJaU+NQ=
github.com/gopherjs/gopherjs v0.0.0-20180628210949-0892b62f0d9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c h1:16eHWuMGvCjSfgRJKqIzapE78onvvTbdi1rMkU00lZw=
github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherwasm v0.1.1 h1:R/3+SfgCFStiql6ICfyfke1WtpglfjIvTEBux8R1euc=
github.com/gopherjs/gopherwasm v0.1.1/go.mod h1:kx4n9a+MzHH0BJJhvlsQ65hqLFXDO/m256AsaDPQ+/4=
github.com/gopherjs/webgl v0.0.0-20180508003723-39bd6d41eeb5 h1:vrKguNTgy5fq7lTzG9YNM9u8QOsNbEN2ejPt1k6gR/4=
github.com/gopherjs/webgl v0.0.0-20180508003723-39bd6d41eeb5/go.mod h1:obh2agNa9TmQ5C1MrSr2jgLIqV0b4Cl96m/ig2VAXwM=
github.com/hajimehoshi/ebiten v1.7.3 h1:i3QDvHYW9mZNhP0V/MHiUNaNN2y/YSfzkGrLKsFzXow=
github.com/hajimehoshi/ebiten v1.7.3/go.mod h1:SkpmXyEqgdQ64FdujyWb5xme7MOl+2g0lnRmKwUJxGQ=
github.com/hajimehoshi/go-mp3 v0.1.1 h1:Y33fAdTma70fkrxnc9u50Uq0lV6eZ+bkAlssdMmCwUc=
github.com/hajimehoshi/go-mp3 v0.1.1/go.mod h1:4i+c5pDNKDrxl1iu9iG90/+fhP37lio6gNhjCx9WBJw=
github.com/hajimehoshi/go-mplusbitmap v1.0.1 h1:Q7vA2o/9uIXS0isGPeXc4ahLMFBfZl592OZgb/MH90w=
github.com/hajimehoshi/go-mplusbitmap v1.0.1/go.mod h1:zW+y7DzqcVGNiGVPga2gau26lxIzv7zvtOEjgMiz6pU=
github.com/hajimehoshi/oto v0.1.1/go.mod h1:hUiLWeBQnbDu4pZsAhOnGqMI1ZGibS6e2qhQdfpwz04=
github.com/hajimehoshi/oto v0.1.2/go.mod h1:1iS1lbBMU/SpoU8yZkduCxbqV/hVdGRiNwgbvYO3sG4=
github.com/hajimehoshi/oto v0.1.3 h1:d81EeDEwougdKctpbEs1hsdEqEOnzXlh2zXDjdN4AlI=
github.com/hajimehoshi/oto v0.1.3/go.mod h1:1iS1lbBMU/SpoU8yZkduCxbqV/hVdGRiNwgbvYO3sG4=
github.com/jakecoffman/cp v0.1.0/go.mod h1:a3xPx9N8RyFAACD644t2dj/nK4SuLg1v+jL61m2yVo4=
github.com/jfreymuth/oggvorbis v1.0.0/go.mod h1:abe6F9QRjuU9l+2jek3gj46lu40N4qlYxh2grqkLEDM=
github.com/jfreymuth/vorbis v1.0.0/go.mod h1:8zy3lUAm9K/rJJk223RKy6vjCZTWC61NA2QD06bfOE0=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.2/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/pkg/browser v0.0.0-20170505125900-c90ca0c84f15/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
Expand All @@ -38,17 +41,21 @@ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/theckman/go-flock v0.4.0 h1:bcqNkS4RTQBGWybG7IBimUMxnLz53Qes1+D4QaOhzJc=
github.com/theckman/go-flock v0.4.0/go.mod h1:kjuth3y9VJ2aNlkNEO99G/8lp9fMIKaGyBmh84IBheM=
github.com/theckman/go-flock v0.5.0 h1:LVkID+taGr6mTeD+ptyj5QP6qwpD+nPJBqndoztoHVQ=
github.com/theckman/go-flock v0.5.0/go.mod h1:kjuth3y9VJ2aNlkNEO99G/8lp9fMIKaGyBmh84IBheM=
golang.org/x/exp v0.0.0-20180710024300-14dda7b62fcd h1:nLIcFw7GiqKXUS7HiChg6OAYWgASB2H97dZKd1GhDSs=
golang.org/x/exp v0.0.0-20180710024300-14dda7b62fcd/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180907224206-e88728d35e99 h1:7IN8+ZMp04l/19EF+wsr7NM1jyvcadKINimAtWRyQk8=
golang.org/x/exp v0.0.0-20180907224206-e88728d35e99/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81 h1:00VmoueYNlNz/aHIilyyQz/MHSqGoWJzpFv/HW8xpzI=
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
golang.org/x/mobile v0.0.0-20180806140643-507816974b79 h1:t2JRgCWkY7Qaa1J2jal+wqC9OjbyHCHwIA9rVlRUSMo=
golang.org/x/mobile v0.0.0-20180806140643-507816974b79/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20180907224111-0ff817254b04 h1:quPNpjsj/QWqlvWw4OdGlA+ct0TPbmdJXYofkRod1Xo=
golang.org/x/mobile v0.0.0-20180907224111-0ff817254b04/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/sys v0.0.0-20180806082429-34b17bdb4300 h1:eJa+6+7jje7fOYUrLnwKNR9kcpvLANj1Asw0Ou1pBiI=
golang.org/x/sys v0.0.0-20180806082429-34b17bdb4300/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

0 comments on commit d3f4d64

Please sign in to comment.