Giter Club home page Giter Club logo

igloo's People

Contributors

dependabot[bot] avatar miniscruff avatar

Watchers

 avatar  avatar

igloo's Issues

Game wrapper

Ebiten has a run game interface, implement our base game struct for scene loading, updating, and drawing.

Basic sprite implementation

  • image to draw
  • position to draw at ( transform )
  • bounds to draw on ( width/height )
  • checks self dirty before drawing
  • checks camera view
  • checks dirty for transform
  • can change width/height
  • includes camera and a drawer interfaces
  • new sprite with minimum requirements
  • new sprite with anchor and width/height option
  • add top-left to transform, to help with is in view checks to account for when anchor is not (0,0)

Create example folder

  • Menu scene
  • Box creation and rotation scene
  • Left-click + drag to create a box
  • Boxes will spin based on there size

New blank image helper

Creating blank images of a specific color requires two methods, and as it can be nice for tests it could be helpful as a util method.

Expand Transform

Currently transform is limited to position and rotation. This is only part of what a 2D object consists of and therefore lots of code is duplicated between the label and sprite types.

Instead our transforms should be everything related to our bounds including width, height, anchors and also building the geom for ebiten.

Rebuild nine slices

Build a content type called nine slices with sides instead of borders.
Then a graphics type called nine slices for rendering

Create a content manager to load, cache and dispose in one location

Currently our scenes will have a list of assets we load at the start, then dispose of when we exit the scene. It also means we have to carry around any assets to structs as we need to dispose of them later.

Instead a content manager that wraps the loading and unloading will simplify this process.

Create FSM system that can be used like a component

State management that uses the event system to swap from one state to another, the system would then be able to change or do whatever it needed to do.

For example:

type DoorState string
const (
    OpenDoor DoorState = "open"
    ClosedDoor = "closed"
)

type Door struct {
    sprite *Sprite
    transform *Transform
    playerTransform *Transform
    fsm *FSM[DoorState]
}

func (d *DoorEntity) Update() {
    sqrDist := d.transform.Position().SqrDist(d.playerTransform.Position())
    inRange := sqrDist < config.DoorRange * config.DoorRange
    if inRange {
        d.fsm.Transition(OpenDoor)
    } else {
        d.fsm.Transition(ClosedDoor)
    }
}

func (d *DoorEntity) Draw(dest *ebiten.Image, camera Camera) {
    d.sprite.Draw(dest, camera)
}

func NewDoor(sprite *Sprite, playerTransform *PlayerTransform) *Door {
    fsm := NewFSM[DoorState](
        Closed, // start state
        FSMTransition(OpenDoor, []DoorState{ClosedDoor}),
        FSMTransition(ClosedDoor, []DoorState{OpenDoor}),
    )
    fsm.OnTransition(OpenDoor, func() {
        d.tween.Bounce()
    })
    fsm.OnTransition(CloseDoor, func() {
        d.tween.Bounce()
    })
    return &Door{
        sprite: sprite,
        transform: sprite.Transform,
        playerTransform: playerTransform,
        fsm: fsm,
    }
}

Tickers should start paused

Currently the ticker will start anything that is added to the ticker. This does not give us the option to pause anything on start for tweens or timers. Therefore, we should not auto start tickers for greater control.

Remake tickers to be in ticks not time

Everything should be in a "per tick" amount not time. Also do some cleanup and tests of the tween system.

TickRunner: Runs all the tickers, part of scene context
Ticker: Single ticker with events
Tween: a type of ticker
Timer: another type of ticker

Game needs a "get active context" sort of function so we can get the active tick runner to add to

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.