Code Monkey home page Code Monkey logo

pacman's Introduction

Pacman

Go to game Go Report Card

Classic Pacman with procedurally generated infinite vertical maze.

Sample

Motivation

I came across Eller's algorithm for maze generation, a few months back. Eller's algorithm creates a perfect maze, by generating next row, on basis of current row. Giving us ability to create maze with infinite rows.

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 2D game engine a bit and this gave me a good opportunity to use it. For maze generation I slightly modified Eller's algorithm to create non-perfect mazes.

Build

Using go get & without go modules.

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

Using git clone & go modules.

$ 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. Ebiten supports browsers by using webgl.

Note: Setup repo beforehand, as shown above.

To build just go code.

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

To build gh-pages.

$ 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

pacman's People

Contributors

skatiyar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pacman's Issues

Is this my problem?

$ go build -o pacman main.go
go: downloading github.com/hajimehoshi/ebiten v1.8.0
verifying github.com/hajimehoshi/[email protected]: checksum mismatch
downloaded: h1:8PLZSQ//ukmVJl3LuPBdiWmV/xh0tGcBAW+PDO7dyuA=
go.sum: h1:m4XT/9S+6L0ib9EiWLDCSNcgm4sQy2/iTgGy/ypYHvE=

SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

ARM64 for apple silicon

Hi. I`m build your app and runing well but is Intel64 bit. How to compile your app with go for arm64 ?? Thank you so much for any help.

When I try to build on arm got this message but is no app in build folder

go build -o pacman main.go                                                                                                                                                                          
# github.com/hajimehoshi/oto
../../../go/pkg/mod/github.com/hajimehoshi/[email protected]/driver_openal.go:36:22: warning: 'alcOpenDevice' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/alc.h:209:38: note: 'alcOpenDevice' has been explicitly marked deprecated here
../../../go/pkg/mod/github.com/hajimehoshi/[email protected]/driver_openal.go:40:11: warning: 'alcCloseDevice' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/alc.h:211:38: note: 'alcCloseDevice' has been explicitly marked deprecated here
../../../go/pkg/mod/github.com/hajimehoshi/[email protected]/driver_openal.go:44:22: warning: 'alcCreateContext' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/alc.h:191:38: note: 'alcCreateContext' has been explicitly marked deprecated here
../../../go/pkg/mod/github.com/hajimehoshi/[email protected]/driver_openal.go:48:11: warning: 'alcGetError' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/alc.h:218:38: note: 'alcGetError' has been explicitly marked deprecated here
../../../go/pkg/mod/github.com/hajimehoshi/[email protected]/driver_openal.go:52:4: warning: 'alcMakeContextCurrent' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/alc.h:193:38: note: 'alcMakeContextCurrent' has been explicitly marked deprecated here
../../../go/pkg/mod/github.com/hajimehoshi/[email protected]/driver_openal.go:56:4: warning: 'alcDestroyContext' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/alc.h:199:38: note: 'alcDestroyContext' has been explicitly marked deprecated here
cgo-gcc-prolog:152:2: warning: 'alBufferData' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/al.h:601:25: note: 'alBufferData' has been explicitly marked deprecated here
cgo-gcc-prolog:166:2: warning: 'alDeleteBuffers' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/al.h:595:25: note: 'alDeleteBuffers' has been explicitly marked deprecated here
cgo-gcc-prolog:180:2: warning: 'alDeleteSources' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/al.h:501:25: note: 'alDeleteSources' has been explicitly marked deprecated here
cgo-gcc-prolog:194:2: warning: 'alGenBuffers' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/al.h:592:25: note: 'alGenBuffers' has been explicitly marked deprecated here
cgo-gcc-prolog:208:2: warning: 'alGenSources' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/al.h:498:25: note: 'alGenSources' has been explicitly marked deprecated here
cgo-gcc-prolog:222:2: warning: 'alGetSourcei' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/al.h:530:25: note: 'alGetSourcei' has been explicitly marked deprecated here
cgo-gcc-prolog:238:35: warning: 'alGetString' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/al.h:382:34: note: 'alGetString' has been explicitly marked deprecated here
cgo-gcc-prolog:254:2: warning: 'alSourcePlay' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/al.h:558:25: note: 'alSourcePlay' has been explicitly marked deprecated here
cgo-gcc-prolog:268:2: warning: 'alSourceQueueBuffers' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/al.h:572:25: note: 'alSourceQueueBuffers' has been explicitly marked deprecated here
cgo-gcc-prolog:281:2: warning: 'alSourceRewind' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/al.h:564:25: note: 'alSourceRewind' has been explicitly marked deprecated here
cgo-gcc-prolog:294:2: warning: 'alSourceStop' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/al.h:561:25: note: 'alSourceStop' has been explicitly marked deprecated here
cgo-gcc-prolog:308:2: warning: 'alSourceUnqueueBuffers' is deprecated: first deprecated in macOS 10.15 - OpenAL is deprecated in favor of AVAudioEngine [-Wdeprecated-declarations]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/OpenAL.framework/Headers/al.h:574:25: note: 'alSourceUnqueueBuffers' has been explicitly marked deprecated here
# github.com/hajimehoshi/ebiten/internal/graphicsdriver/metal/mtl
In file included from mtl.m:18:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.h:9:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLTypes.h:8:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:60:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFPropertyList.h:17:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFStream.h:20:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/dispatch/dispatch.h:63:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/os/object.h:111:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/objc/NSObject.h:10:
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/objc/objc.h:78:18: error: typedef redefinition with different types ('bool' vs 'signed char')
../../../go/pkg/mod/github.com/hajimehoshi/[email protected]/internal/graphicsdriver/metal/mtl/mtl.h:19:21: note: previous definition is here
# github.com/go-gl/glfw/v3.2/glfw
In file included from ../../../go/pkg/mod/github.com/go-gl/[email protected]/v3.2/glfw/c_glfw_darwin.go:8:
../../../go/pkg/mod/github.com/go-gl/[email protected]/v3.2/glfw/glfw/src/cocoa_window.m:989:9: warning: multiple methods named 'center' found [-Wobjc-multiple-method-names]
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCollectionViewCompositionalLayout.h:604:19: note: using
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:340:1: note: also found

Strange rendering result on non-retina display on browsers

Hi, thank you for using Ebiten!

I found your pacman on browser on non-retina display doesn't run well (I'll add a screenshot later when I'm available). You specify 1 / ebiten.DeviceScaleFactor() for the game scale, which means that the whole screen size in device-independent pixels (= px on browsers) would change by the resolution (window.devicePixelRatio on browsers). The game screen size is 712x1220, and iframe's size is specified 356px and 610px, so I guess the game properly works only when ebiten.DeviceScaleFactor() is 2.

Thus, always specifying 0.5 should work in there in this case.

Input controls

On the demo, I'm not sure I see pacman and when I use the arrow keys nothing seems to happen. Pretty cool otherwise!

How do you make a web game in GoLang btw? ๐Ÿ˜„

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.