mouse-follow

command
v0.0.0-...-8fc0beb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2016 License: MIT Imports: 5 Imported by: 0

README

Mouse Follow Demo

What does it do?

It demonstrates how one can implement a sprite that will follow the user's mouse movements.

What are important aspects of the code?

These things are key in this demo:

  • FollowSystem, which implements an update method that sets the SpaceComponent(sprite)'s position to that of the current mouse position. Like so:
func (s *FollowSystem) Update(dt float32) {
    for _, e := range s.entities {
        e.SpaceComponent.Position.X += engo.Input.Axis(engo.DefaultMouseXAxis).Value()
        e.SpaceComponent.Position.Y += engo.Input.Axis(engo.DefaultMouseYAxis).Value()
    }
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL