GopherMoves is a Go package that provides an interface and an example implementation for simulating the movements of a character, particularly designed for a Gopher character.
Demo.mov
To use GopherMoves in your Go project, you can simply run:
go get -u github.com/renanbastos93/gophermoves
package main
import "github.com/renanbastos93/gophermoves"
func main() {
orderMatrix := 5
g := gophermoves.New(orderMatrix)
err := g.Start()
if err != nil {
panic(err.Error())
}
}
The GopherMoves interface provides the following methods:
Start() (err error)
: Initiates movements for the character.Reset()
: Redefines the default states of the X and Y positions.Up()
: Moves the character upward.Down()
: Moves the character downward.Left()
: Turns the character to the left.Right()
: Turns the character to the right.
Feel free to contribute to this project. If you find any issues or have suggestions, please open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.