Skip to content

Commit

Permalink
- add item consume logic for combat
Browse files Browse the repository at this point in the history
- add heal floating texts
- add buff indicator images during combat
- add mana potion item
  • Loading branch information
Quillraven committed Jun 6, 2021
1 parent 9f5b2cc commit 6e6fa7a
Show file tree
Hide file tree
Showing 14 changed files with 296 additions and 88 deletions.
81 changes: 44 additions & 37 deletions assets/graphics/ui.atlas
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ filter: Nearest,Nearest
repeat: none
bar_blue
rotate: false
xy: 86, 213
xy: 86, 221
size: 42, 3
split: 1, 3, 1, 1
pad: 0, 0, 0, 0
Expand All @@ -15,7 +15,7 @@ bar_blue
index: -1
bar_frame-1
rotate: false
xy: 572, 725
xy: 572, 733
size: 45, 7
split: 1, 5, 2, 2
pad: 0, 0, 0, 0
Expand All @@ -24,7 +24,7 @@ bar_frame-1
index: -1
bar_red
rotate: false
xy: 572, 718
xy: 572, 726
size: 42, 3
split: 1, 3, 1, 1
pad: 0, 0, 0, 0
Expand All @@ -33,16 +33,23 @@ bar_red
index: -1
bar_yellow
rotate: false
xy: 520, 675
xy: 520, 683
size: 42, 3
split: 1, 3, 1, 1
pad: 0, 0, 0, 0
orig: 42, 3
offset: 0, 0
index: -1
buff-01
rotate: false
xy: 540, 643
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
button-1
rotate: false
xy: 4, 120
xy: 4, 128
size: 30, 14
split: 10, 10, 4, 3
pad: 0, 0, 0, 0
Expand All @@ -51,7 +58,7 @@ button-1
index: -1
button-2
rotate: false
xy: 520, 682
xy: 520, 690
size: 46, 14
split: 15, 15, 4, 3
pad: 0, 0, 0, 0
Expand All @@ -60,35 +67,35 @@ button-2
index: -1
button-down
rotate: false
xy: 520, 599
xy: 540, 627
size: 12, 12
orig: 12, 12
offset: 0, 0
index: -1
button-esc
rotate: false
xy: 4, 48
xy: 520, 591
size: 12, 12
orig: 12, 12
offset: 0, 0
index: -1
button-space
rotate: false
xy: 520, 583
xy: 4, 36
size: 12, 12
orig: 12, 12
offset: 0, 0
index: -1
button-up
rotate: false
xy: 520, 551
xy: 4, 4
size: 12, 12
orig: 12, 12
offset: 0, 0
index: -1
frame-1
rotate: false
xy: 4, 138
xy: 4, 146
size: 30, 30
split: 10, 10, 10, 10
pad: 0, 0, 0, 0
Expand All @@ -97,7 +104,7 @@ frame-1
index: -1
frame-2
rotate: false
xy: 52, 186
xy: 52, 194
size: 30, 30
split: 10, 10, 10, 10
pad: 0, 0, 0, 0
Expand All @@ -106,7 +113,7 @@ frame-2
index: -1
frame-3
rotate: false
xy: 4, 172
xy: 4, 180
size: 44, 44
split: 13, 13, 13, 13
pad: 0, 0, 0, 0
Expand All @@ -115,7 +122,7 @@ frame-3
index: -1
frame-green
rotate: false
xy: 588, 702
xy: 588, 710
size: 12, 12
split: 4, 4, 4, 4
pad: 0, 0, 0, 0
Expand All @@ -124,7 +131,7 @@ frame-green
index: -1
frame-red
rotate: false
xy: 520, 567
xy: 4, 20
size: 12, 12
split: 4, 4, 4, 4
pad: 0, 0, 0, 0
Expand All @@ -133,154 +140,154 @@ frame-red
index: -1
gamepad-a
rotate: false
xy: 540, 619
xy: 4, 52
size: 12, 12
orig: 12, 12
offset: 0, 0
index: -1
gamepad-b
rotate: false
xy: 4, 16
xy: 520, 559
size: 12, 12
orig: 12, 12
offset: 0, 0
index: -1
gamepad-down
rotate: false
xy: 24, 104
xy: 24, 112
size: 8, 12
orig: 8, 12
offset: 0, 0
index: -1
gamepad-left
rotate: false
xy: 4, 4
xy: 520, 547
size: 12, 8
orig: 12, 8
offset: 0, 0
index: -1
gamepad-right
rotate: false
xy: 52, 174
xy: 52, 182
size: 12, 8
orig: 12, 8
offset: 0, 0
index: -1
gamepad-up
rotate: false
xy: 38, 156
xy: 38, 164
size: 8, 12
orig: 8, 12
offset: 0, 0
index: -1
gamepad-x
rotate: false
xy: 572, 702
xy: 572, 710
size: 12, 12
orig: 12, 12
offset: 0, 0
index: -1
gamepad-y
rotate: false
xy: 4, 32
xy: 520, 575
size: 12, 12
orig: 12, 12
offset: 0, 0
index: -1
gold
rotate: false
xy: 621, 726
xy: 621, 734
size: 5, 6
orig: 5, 6
offset: 0, 0
index: -1
immortal
rotate: false
xy: 4, 220
xy: 4, 228
size: 512, 512
orig: 512, 512
offset: 0, 0
index: -1
item-20
rotate: false
xy: 520, 615
xy: 520, 623
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
item-24
rotate: false
xy: 540, 635
xy: 4, 68
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
item-29
rotate: false
xy: 540, 655
xy: 540, 663
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
item-31
rotate: false
xy: 520, 655
xy: 520, 663
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
item-35
rotate: false
xy: 520, 635
xy: 520, 643
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
item-51
rotate: false
xy: 86, 193
xy: 86, 201
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
item-55
rotate: false
xy: 4, 100
xy: 4, 108
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
item-56
rotate: false
xy: 106, 193
xy: 106, 201
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
item-61
rotate: false
xy: 4, 80
xy: 4, 88
size: 16, 16
orig: 16, 16
offset: 0, 0
index: -1
selection
rotate: false
xy: 604, 706
xy: 604, 714
size: 6, 8
orig: 6, 8
offset: 0, 0
index: -1
undefined
rotate: false
xy: 4, 64
xy: 520, 607
size: 12, 12
orig: 12, 12
offset: 0, 0
index: -1
window-1
rotate: false
xy: 520, 700
xy: 520, 708
size: 48, 32
split: 16, 16, 10, 11
pad: 0, 0, 0, 0
Expand Down
Binary file modified assets/graphics/ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/i18n.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Ability.CommandProtect.name=Protes
Ability.CommandFirebolt.name=Firebolt
Ability.CommandExplosion.name=Explosion
Ability.CommandUseItem.name=Use Item
Buff.ProtectBuff.skinRegionKey=buff-01
CombatView.attack=Attack
CombatView.ability=Ability
CombatView.item=Item
Expand All @@ -24,6 +26,9 @@ Item.HAT.skinRegionKey=item-55
Item.HEALTH_POTION.name=Health Potion
Item.HEALTH_POTION.description=A flask with a red substance that restores [#33EE22]50[] life
Item.HEALTH_POTION.skinRegionKey=item-29
Item.MANA_POTION.name=Mana Potion
Item.MANA_POTION.description=A flask with a blue substance that restores [#33EE22]10[] mana
Item.MANA_POTION.skinRegionKey=item-31
Item.LEATHER_BOOTS.name=Leather Boots
Item.LEATHER_BOOTS.description=Basic boots
Item.LEATHER_BOOTS.skinRegionKey=item-51
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ enum class ItemType(val gearType: GearType = GearType.UNDEFINED) {
LEATHER_GLOVES(GearType.GLOVES),
LEATHER_BOOTS(GearType.BOOTS),
BUCKLER(GearType.SHIELD),
HEALTH_POTION;
HEALTH_POTION,
MANA_POTION;

companion object {
private val GEAR_ITEM_TYPES = values().filter { it.gearType != GearType.UNDEFINED }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ fun Engine.createPlayerEntity(world: World, x: Float, y: Float): Entity {
with<BagComponent> {
// TODO remove debug stuff
items[ItemType.HEALTH_POTION] = createItemEntity(ItemType.HEALTH_POTION, 5)
items[ItemType.MANA_POTION] = createItemEntity(ItemType.MANA_POTION, 1)
}
with<InteractComponent>()
with<MoveComponent> { maxSpeed = 5f }
Expand All @@ -186,6 +187,7 @@ fun Engine.createPlayerEntity(world: World, x: Float, y: Float): Entity {
with<CombatComponent> {
learn<CommandAttack>()
learn<CommandDeath>()
learn<CommandUseItem>()
//TODO remove debug stuff
learn<CommandProtect>()
learn<CommandFirebolt>()
Expand Down Expand Up @@ -229,6 +231,12 @@ fun Engine.createItemEntity(type: ItemType, numItems: Int = 1): Entity {
stats[StatsType.LIFE] = 50f
}
}
ItemType.MANA_POTION -> {
with<ConsumableComponent>()
with<StatsComponent> {
stats[StatsType.MANA] = 10f
}
}
ItemType.LEATHER_BOOTS -> {
with<StatsComponent> {
stats[StatsType.PHYSICAL_ARMOR] = 1f
Expand Down
Loading

0 comments on commit 6e6fa7a

Please sign in to comment.