-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ground and general improvements
- Loading branch information
Showing
17 changed files
with
120 additions
and
34 deletions.
There are no files selected for viewing
Binary file not shown.
13 changes: 10 additions & 3 deletions
13
android/assets/images/altas.pack.atlas → android/assets/images/atlas.pack.atlas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.mygdx.game.entities | ||
|
||
import com.badlogic.ashley.core.PooledEngine | ||
import com.badlogic.gdx.graphics.g2d.NinePatch | ||
import com.mygdx.game.Assets | ||
import com.mygdx.game.Constants | ||
import com.mygdx.game.components.DrawableComponent | ||
import com.mygdx.game.components.ScrollComponent | ||
import com.mygdx.game.components.TransformComponent | ||
import ktx.ashley.entity | ||
import ktx.ashley.with | ||
|
||
object Ground { | ||
/** | ||
* Create enough ground entities in the world | ||
*/ | ||
fun init(engine: PooledEngine) { | ||
for (i in 0 until Constants.WORLD_GROUND_COUNT) { | ||
engine.entity { | ||
with<TransformComponent> { | ||
pos.set(i * Constants.GROUND_WIDTH, 0f, -2f) | ||
// +0.1f to make seamless | ||
size.set(Constants.GROUND_WIDTH + 0.1f, Constants.GROUND_HEIGHT) | ||
} | ||
with<ScrollComponent> { | ||
willCycle = true | ||
cycleWidth = Constants.GROUND_CYCLE_WIDTH | ||
} | ||
with<DrawableComponent> { | ||
set(NinePatch(Assets.Sprites.GROUND.texture, Constants.GROUND_WIDTH.toInt() - 1, 0, Constants.GROUND_EDGE_TOP, 0)) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters