Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

Just click the "<>" button to enable html, and then: <img src="{image_uri}" />


Nice starfield btw. I'm looking into a good way to do this without having to use a static image resource and hopefully draw them programatically.

Ah thanks!

The starfield is a single star image, added every x seconds with random scale and velocity :

package org.sturgeon.sweeper.systems

import com.badlogic.ashley.core.Entity
import com.badlogic.ashley.systems.IntervalSystem
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.math.MathUtils
import org.sturgeon.sweeper.Assets
import org.sturgeon.sweeper.components.BoundsCheckComponent
import org.sturgeon.sweeper.components.MovementComponent
import org.sturgeon.sweeper.components.PositionComponent
import org.sturgeon.sweeper.components.VisualComponent


class StarfieldSystem(var i:Float) : IntervalSystem(i) {
    
    override fun updateInterval() {
        var star = Entity()

        var t = Texture(Assets.STAR)

        var pc = PositionComponent(Assets.VIEWPORT_WIDTH+100,
                MathUtils.random(0f, Assets.VIEWPORT_HEIGHT),
                t.width.toFloat(), t.height.toFloat())

        var scale = MathUtils.random(0.1f, 1.2f)
        pc.scaleX = scale
        pc.scaleY = scale

        star.add(pc)

        star.add(VisualComponent(t, 0))
        star.add(MovementComponent(MathUtils.random(-300f, -100f), 0f))
        star.add(BoundsCheckComponent())

        engine.addEntity(star)
    }
}