Various additions

This commit is contained in:
Anuken
2017-04-30 02:07:58 -04:00
parent 4c26efaef6
commit 96e6d1488d
26 changed files with 628 additions and 302 deletions

View File

@ -6,14 +6,14 @@ filter: Nearest,Nearest
repeat: none
block
rotate: false
xy: 105, 23
xy: 117, 23
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
bullet
rotate: false
xy: 115, 23
xy: 127, 23
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -27,77 +27,77 @@ circle
index: -1
coal1
rotate: false
xy: 125, 23
xy: 137, 23
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
coal2
rotate: false
xy: 135, 23
xy: 147, 23
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
coal3
rotate: false
xy: 145, 23
xy: 157, 23
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
coaldrill
rotate: false
xy: 155, 23
xy: 167, 23
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
conveyor
rotate: false
xy: 165, 23
xy: 177, 23
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
conveyormove
rotate: false
xy: 175, 23
xy: 187, 23
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
core
rotate: false
xy: 185, 23
xy: 197, 23
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
dirt1
rotate: false
xy: 195, 23
xy: 207, 23
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
dirt2
rotate: false
xy: 205, 23
xy: 217, 23
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
dirt3
rotate: false
xy: 215, 23
xy: 227, 23
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
dirtblock
rotate: false
xy: 225, 23
xy: 237, 23
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -111,7 +111,7 @@ doubleturret
index: -1
drill
rotate: false
xy: 235, 23
xy: 247, 23
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -125,21 +125,21 @@ flameturret
index: -1
furnace
rotate: false
xy: 245, 23
xy: 25, 11
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
smelter
rotate: false
xy: 245, 23
xy: 25, 11
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
grass
rotate: false
xy: 25, 11
xy: 25, 1
size: 8, 8
orig: 8, 8
offset: 0, 0
@ -153,70 +153,70 @@ healturret
index: -1
icon-coal
rotate: false
xy: 25, 1
xy: 35, 11
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
icon-iron
rotate: false
xy: 35, 11
xy: 35, 1
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
icon-steel
rotate: false
xy: 35, 1
xy: 45, 11
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
icon-stone
rotate: false
xy: 45, 11
xy: 45, 1
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
iron1
rotate: false
xy: 45, 1
xy: 55, 11
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
iron2
rotate: false
xy: 55, 11
xy: 55, 1
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
iron3
rotate: false
xy: 55, 1
xy: 65, 11
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
irondrill
rotate: false
xy: 65, 11
xy: 65, 1
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
ironwall
rotate: false
xy: 65, 1
xy: 75, 11
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
laser
rotate: false
xy: 135, 9
xy: 115, 7
size: 1, 12
orig: 1, 12
offset: 0, 0
@ -236,121 +236,135 @@ machineturret
offset: 0, 0
index: -1
mech1
rotate: false
xy: 75, 11
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
player
rotate: false
xy: 75, 1
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
router
rotate: false
xy: 85, 11
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
shadow
megahealturret
rotate: false
xy: 57, 21
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
shotgunturret
player
rotate: false
xy: 69, 21
size: 10, 10
orig: 10, 10
xy: 85, 11
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
sniperturret
rotate: false
xy: 81, 21
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
steelconveyor
router
rotate: false
xy: 85, 1
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
steelconveyormove
shadow
rotate: false
xy: 95, 11
size: 8, 8
orig: 8, 8
xy: 69, 21
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
stone
shotgunturret
rotate: false
xy: 95, 1
size: 8, 8
orig: 8, 8
xy: 81, 21
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
stone1
rotate: false
xy: 105, 13
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stone2
rotate: false
xy: 105, 3
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stone3
rotate: false
xy: 115, 13
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stoneblock
rotate: false
xy: 115, 3
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stonedrill
rotate: false
xy: 125, 13
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stonedrillhead
rotate: false
xy: 125, 13
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stonewall
rotate: false
xy: 125, 3
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
turret
sniperturret
rotate: false
xy: 93, 21
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
steelconveyor
rotate: false
xy: 95, 11
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
steelconveyormove
rotate: false
xy: 95, 1
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
steelwall
rotate: false
xy: 105, 11
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stone
rotate: false
xy: 105, 1
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stone1
rotate: false
xy: 118, 13
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stone2
rotate: false
xy: 128, 13
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stone3
rotate: false
xy: 138, 13
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stoneblock
rotate: false
xy: 148, 13
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stonedrill
rotate: false
xy: 158, 13
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stonedrillhead
rotate: false
xy: 158, 13
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
stonewall
rotate: false
xy: 168, 13
size: 8, 8
orig: 8, 8
offset: 0, 0
index: -1
turret
rotate: false
xy: 105, 21
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 B

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 B

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 B

After

Width:  |  Height:  |  Size: 243 B

View File

@ -13,7 +13,7 @@ blank
index: -1
border
rotate: false
xy: 651, 72
xy: 677, 72
size: 12, 12
split: 4, 4, 4, 4
orig: 12, 12
@ -69,8 +69,7 @@ button
rotate: false
xy: 823, 86
size: 24, 40
split: 10, 10, 10, 8
pad: 8, 8, 2, 2
split: 10, 10, 8, 8
orig: 24, 40
offset: 0, 0
index: -1
@ -105,8 +104,7 @@ button-down
rotate: false
xy: 641, 86
size: 24, 40
split: 10, 10, 10, 8
pad: 8, 8, 2, 2
split: 10, 10, 8, 8
orig: 24, 40
offset: 0, 0
index: -1
@ -132,8 +130,7 @@ button-over
rotate: false
xy: 719, 86
size: 24, 40
split: 10, 10, 10, 8
pad: 8, 8, 2, 2
split: 10, 10, 8, 8
orig: 24, 40
offset: 0, 0
index: -1
@ -146,6 +143,14 @@ button-red
orig: 24, 40
offset: 0, 0
index: -1
button-select
rotate: false
xy: 563, 60
size: 24, 24
split: 4, 4, 4, 4
orig: 24, 24
offset: 0, 0
index: -1
button-window-bg
rotate: false
xy: 771, 86
@ -193,6 +198,13 @@ check-on
orig: 28, 28
offset: 0, 0
index: -1
clear
rotate: false
xy: 691, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
color-picker-bar-selector
rotate: false
xy: 999, 98
@ -202,7 +214,7 @@ color-picker-bar-selector
index: -1
color-picker-cross
rotate: false
xy: 665, 74
xy: 703, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
@ -230,14 +242,14 @@ cursor
index: -1
cursor-normal
rotate: false
xy: 677, 74
xy: 715, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
default-pane
rotate: false
xy: 130, 21
xy: 186, 2
size: 5, 3
split: 1, 1, 1, 1
orig: 5, 3
@ -261,7 +273,7 @@ default-select
index: -1
default-select-selection
rotate: false
xy: 528, 80
xy: 180, 14
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
@ -269,42 +281,42 @@ default-select-selection
index: -1
grey
rotate: false
xy: 563, 62
xy: 589, 62
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
menu-bg
rotate: false
xy: 563, 62
xy: 589, 62
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
icon-arrow-down
rotate: false
xy: 689, 74
xy: 727, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-arrow-left
rotate: false
xy: 701, 74
xy: 739, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-arrow-right
rotate: false
xy: 713, 74
xy: 751, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-arrow-up
rotate: false
xy: 725, 74
xy: 763, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
@ -332,35 +344,49 @@ icon-close-over
index: -1
icon-copy
rotate: false
xy: 737, 74
xy: 775, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-cursor
rotate: false
xy: 749, 74
xy: 787, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-defense
rotate: false
xy: 799, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-distribution
rotate: false
xy: 811, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-dots
rotate: false
xy: 761, 74
xy: 823, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-dots-down
rotate: false
xy: 773, 74
xy: 835, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-down
rotate: false
xy: 785, 74
xy: 847, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
@ -374,7 +400,7 @@ icon-drive
index: -1
icon-eraser
rotate: false
xy: 797, 74
xy: 859, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
@ -402,21 +428,21 @@ icon-file-pdf
index: -1
icon-file-text
rotate: false
xy: 809, 74
xy: 871, 74
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-fill
rotate: false
xy: 821, 74
xy: 219, 42
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-folder
rotate: false
xy: 833, 74
xy: 231, 42
size: 10, 10
orig: 10, 10
offset: 0, 0
@ -430,7 +456,7 @@ icon-folder-new
index: -1
icon-folder-parent
rotate: false
xy: 845, 74
xy: 243, 42
size: 10, 10
orig: 10, 10
offset: 0, 0
@ -444,14 +470,14 @@ icon-folder-star
index: -1
icon-grid
rotate: false
xy: 857, 74
xy: 255, 42
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-home
rotate: false
xy: 869, 74
xy: 923, 86
size: 10, 10
orig: 10, 10
offset: 0, 0
@ -465,84 +491,91 @@ icon-list-settings
index: -1
icon-load-1
rotate: false
xy: 219, 42
xy: 935, 86
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-load-2
rotate: false
xy: 231, 42
xy: 947, 86
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-load-3
rotate: false
xy: 243, 42
xy: 959, 86
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-lock
rotate: false
xy: 255, 42
xy: 971, 86
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-lock-open
rotate: false
xy: 923, 86
xy: 983, 86
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-minus
rotate: false
xy: 935, 86
xy: 995, 86
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-open
rotate: false
xy: 947, 86
xy: 267, 42
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-open-gray
rotate: false
xy: 959, 86
xy: 279, 44
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-pencil
rotate: false
xy: 971, 86
xy: 291, 44
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-pick
rotate: false
xy: 983, 86
xy: 303, 44
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-plus
rotate: false
xy: 995, 86
xy: 315, 44
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-production
rotate: false
xy: 327, 44
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-redo
rotate: false
xy: 267, 42
xy: 178, 31
size: 10, 10
orig: 10, 10
offset: 0, 0
@ -556,7 +589,7 @@ icon-refresh
index: -1
icon-rename
rotate: false
xy: 279, 44
xy: 190, 31
size: 10, 10
orig: 10, 10
offset: 0, 0
@ -577,49 +610,49 @@ icon-star-outline
index: -1
icon-tap
rotate: false
xy: 291, 44
xy: 168, 14
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-trash
rotate: false
xy: 303, 44
xy: 174, 2
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-undo
rotate: false
xy: 315, 44
xy: 180, 19
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-up
rotate: false
xy: 327, 44
xy: 192, 19
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
icon-zoom
rotate: false
xy: 178, 31
xy: 186, 7
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
list-selection
rotate: false
xy: 605, 65
xy: 130, 23
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
vis-blue
rotate: false
xy: 605, 65
xy: 130, 23
size: 1, 1
orig: 1, 1
offset: 0, 0
@ -717,14 +750,14 @@ scroll-knob-vertical
index: -1
select-box-list-bg
rotate: false
xy: 881, 83
xy: 631, 65
size: 1, 1
orig: 1, 1
offset: 0, 0
index: -1
window-bg
rotate: false
xy: 881, 83
xy: 631, 65
size: 1, 1
orig: 1, 1
offset: 0, 0
@ -745,7 +778,7 @@ select-up
index: -1
selection
rotate: false
xy: 205, 43
xy: 883, 83
size: 1, 1
orig: 1, 1
offset: 0, 0
@ -785,13 +818,6 @@ slider-knob
orig: 22, 44
offset: 0, 0
index: -1
slider-knob-over
rotate: false
xy: 58, 8
size: 22, 44
orig: 22, 44
offset: 0, 0
index: -1
slider-knob-disabled
rotate: false
xy: 82, 16
@ -806,6 +832,13 @@ slider-knob-down
orig: 22, 44
offset: 0, 0
index: -1
slider-knob-over
rotate: false
xy: 106, 16
size: 22, 44
orig: 22, 44
offset: 0, 0
index: -1
slider-vertical
rotate: false
xy: 70, 2
@ -873,7 +906,7 @@ vis-check-over
index: -1
tooltip-bg
rotate: false
xy: 528, 75
xy: 193, 2
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
@ -888,21 +921,21 @@ touchpad-knob
index: -1
tree-minus
rotate: false
xy: 190, 31
xy: 198, 7
size: 10, 10
orig: 10, 10
offset: 0, 0
index: -1
tree-plus
rotate: false
xy: 605, 68
xy: 631, 68
size: 12, 16
orig: 12, 16
offset: 0, 0
index: -1
tree-selection
rotate: false
xy: 528, 70
xy: 528, 80
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3
@ -917,14 +950,14 @@ vis-check-down
index: -1
vis-check-tick
rotate: false
xy: 563, 65
xy: 589, 65
size: 19, 19
orig: 19, 19
offset: 0, 0
index: -1
vis-check-tick-disabled
rotate: false
xy: 584, 65
xy: 610, 65
size: 19, 19
orig: 19, 19
offset: 0, 0
@ -945,14 +978,14 @@ vis-radio-over
index: -1
vis-radio-tick
rotate: false
xy: 619, 70
xy: 645, 70
size: 14, 14
orig: 14, 14
offset: 0, 0
index: -1
vis-radio-tick-disabled
rotate: false
xy: 635, 70
xy: 661, 70
size: 14, 14
orig: 14, 14
offset: 0, 0
@ -966,7 +999,7 @@ vis-red
index: -1
white
rotate: false
xy: 528, 65
xy: 198, 2
size: 3, 3
orig: 3, 3
offset: 0, 0
@ -975,13 +1008,13 @@ window
rotate: false
xy: 401, 65
size: 27, 61
split: 8, 8, 51, 4
split: 8, 8, 47, 8
orig: 27, 61
offset: 0, 0
index: -1
window-border-bg
rotate: false
xy: 528, 60
xy: 528, 75
size: 3, 3
split: 1, 1, 1, 1
orig: 3, 3

View File

@ -35,7 +35,8 @@ io.anuke.ucore.scene.ui.TextButton$TextButtonStyle: {
io.anuke.ucore.scene.ui.ImageButton$ImageButtonStyle: {
default: {down: button-down, up: button },
blue: {down: button-blue-down, up: button-blue },
toggle: {checked: button-down, down: button-down, up: button }
toggle: {checked: button-down, down: button-down, up: button },
select: {checked: button-select, down: button-select, up: clear },
gray: {down: button-down, up: button-gray, over: button-gray-over, disabled: button},
close-window: {up: button, imageUp: icon-close, imageOver: icon-close-over, imageDown: icon-close-down, disabled: button }
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -88,6 +88,13 @@ public class Control extends RendererModule<Moment>{
Draw.circle(e.x, e.y, 3f + e.ifract() * 3f);
Draw.clear();
});
Effect.addDraw("spawn", 23, e -> {
Draw.thickness(2f);
Draw.color(Hue.mix(Color.DARK_GRAY, Color.SCARLET, e.ifract()));
Draw.circle(e.x, e.y, 7f - e.ifract() * 6f);
Draw.clear();
});
Effect.addDraw("ind", 100, e -> {
Draw.thickness(3f);
@ -210,10 +217,16 @@ public class Control extends RendererModule<Moment>{
return Mathf.scl2(UGraphics.mouseWorldPos().y, TileType.tilesize);
}
boolean validPlace(int x, int y, TileType tile){
boolean validPlace(int x, int y, TileType type){
if(!cursorNear())
return false;
for(Tile spawn : main.spawnpoints){
if(Vector2.dst(x * tilesize, y * tilesize, spawn.worldx(), spawn.worldy()) < main.spawnspace){
return false;
}
}
for(SolidEntity e : Entities.getNearby(x * tilesize, y * tilesize, tilesize * 2f)){
Rectangle.tmp.setSize(e.hitsize);
@ -223,7 +236,7 @@ public class Control extends RendererModule<Moment>{
return false;
}
}
return main.tiles[x][y].block() == TileType.air;
return main.tile(x, y).block() == TileType.air;
}
boolean cursorNear(){
@ -234,7 +247,12 @@ public class Control extends RendererModule<Moment>{
public void update(){
if(Gdx.input.isKeyJustPressed(Keys.ESCAPE))
Gdx.app.exit();
if(!main.playing){
clearScreen();
return;
}
Entities.update();
input();
@ -312,11 +330,19 @@ public class Control extends RendererModule<Moment>{
vector.set(7, 0).rotate(main.rotation * 90);
Draw.line(x, y, x + vector.x, y + vector.y);
}
Draw.thickness(1f);
Draw.color("scarlet");
for(Tile spawn : main.spawnpoints){
Draw.dashcircle(spawn.worldx(), spawn.worldy(), main.spawnspace);
}
if(valid)
Cursors.setHand();
else
Cursors.restoreCursor();
Draw.clear();
}
//block breaking

View File

@ -15,6 +15,7 @@ import io.anuke.moment.world.TileType;
import io.anuke.ucore.core.KeyBinds;
import io.anuke.ucore.core.Settings;
import io.anuke.ucore.core.UInput;
import io.anuke.ucore.entities.Effects;
import io.anuke.ucore.modules.ModuleController;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Timers;
@ -31,10 +32,13 @@ public class Moment extends ModuleController<Moment>{
public float placerange = 60;
public int wave = 1;
public float wavespace = 2000/100;
public float wavespace = 1000;
public float wavetime = wavespace;
public float spawnspace = 65;
public Tile core;
public Array<Tile> spawnpoints = new Array<Tile>();
public boolean playing = false;
@Override
public void init(){
@ -78,14 +82,20 @@ public class Moment extends ModuleController<Moment>{
public void update(){
super.update();
if(!playing) return;
if(Enemy.amount == 0)
wavetime -= delta();
wavetime -= delta();
if(wavetime < 0 || UInput.keyUp(Keys.F)){
runWave();
}
}
public void play(){
playing = true;
}
public void coreDestroyed(){
//TODO "you lose" message or something
}
@ -126,7 +136,9 @@ public class Moment extends ModuleController<Moment>{
Tile tile = spawnpoints.get(point);
Timers.run((int)(i/spawnpoints.size)*40f, ()->{
new Enemy(point).set(tile.worldx(), tile.worldy()).add();
Enemy e = new Enemy(point).set(tile.worldx(), tile.worldy());
Effects.effect("spawn", e);
e.add();
});
}
@ -140,10 +152,6 @@ public class Moment extends ModuleController<Moment>{
return tiles[x][y];
}
public Tile spawn(){
return tiles[size/2][size-1];
}
public void addItem(Item item, int amount){
items.put(item, items.get(item, 0)+amount);
get(UI.class).updateItems();

View File

@ -2,13 +2,13 @@ package io.anuke.moment;
import static io.anuke.moment.world.TileType.tilesize;
import java.util.function.BooleanSupplier;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.utils.Align;
import com.badlogic.gdx.utils.Array;
import io.anuke.moment.entities.Enemy;
import io.anuke.moment.resource.Item;
import io.anuke.moment.resource.ItemStack;
import io.anuke.moment.resource.Recipe;
import io.anuke.moment.resource.*;
import io.anuke.moment.world.Tile;
import io.anuke.moment.world.TileType;
import io.anuke.ucore.core.Draw;
@ -17,60 +17,197 @@ import io.anuke.ucore.modules.SceneModule;
import io.anuke.ucore.scene.builders.*;
import io.anuke.ucore.scene.style.Styles;
import io.anuke.ucore.scene.ui.*;
import io.anuke.ucore.scene.ui.layout.Stack;
import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.util.Mathf;
public class UI extends SceneModule<Moment>{
Table itemtable;
public UI(){
PrefsDialog prefs;
KeybindDialog keys;
Dialog about;
BooleanSupplier play = () -> {
return main.playing;
};
BooleanSupplier nplay = () -> {
return !main.playing;
};
public UI() {
Styles.styles.font().setUseIntegerPositions(false);
TooltipManager.getInstance().animations = false;
Dialog.closePadR = -1;
Dialog.closePadT = 4;
}
@Override
public void update(){
scene.getBatch().setProjectionMatrix(get(Control.class).camera.combined);
scene.getBatch().begin();
Tile tile = main.tiles[tilex()][tiley()];
if(tile.block() != TileType.air){
String error = tile.block().error(tile);
if(error != null){
Draw.tcolor(Color.SCARLET);
Draw.tscl(1/8f);
Draw.text(error, tile.worldx(), tile.worldy()+tilesize);
}else if(tile.block().name().contains("turret")){
Draw.tscl(1/8f);
Draw.tcolor(Color.GREEN);
Draw.text("Ammo: " + tile.entity.shots, tile.worldx(), tile.worldy()-tilesize);
if(main.playing){
scene.getBatch().setProjectionMatrix(get(Control.class).camera.combined);
scene.getBatch().begin();
Tile tile = main.tiles[tilex()][tiley()];
if(tile.block() != TileType.air){
String error = tile.block().error(tile);
if(error != null){
Draw.tcolor(Color.SCARLET);
Draw.tscl(1 / 8f);
Draw.text(error, tile.worldx(), tile.worldy() + tilesize);
}else if(tile.block().name().contains("turret")){
Draw.tscl(1 / 8f);
Draw.tcolor(Color.GREEN);
Draw.text("Ammo: " + tile.entity.shots, tile.worldx(), tile.worldy() - tilesize);
}
Draw.tscl(0.5f);
Draw.clear();
}
scene.getBatch().end();
}else{
Draw.tscl(0.5f);
Draw.clear();
}
scene.getBatch().end();
super.update();
}
@Override
public void init(){
prefs = new PrefsDialog("Settings");
prefs.sliderPref("screenshake", "Screen Shake", 4, 0, 12, i -> {
return (i / 4f) + "x";
});
/*
* prefs.sliderPref("difficulty", "Difficulty", 1, 0, 3, i->{ return
* (i/3f) + "x"; });
*/
keys = new KeybindDialog();
about = new Dialog("About");
about.getContentTable().add("Made by Anuken for the" + "\nGDL Metal Monstrosity jam." + "\nTools used:");
about.addCloseButton();
build.begin(scene);
new table(){{
abottom();
aright();
new table(){{
get().background("button");
int rows = 3;
int maxcol = 0;
float size = 46;
Stack stack = new Stack();
ButtonGroup<ImageButton> group = new ButtonGroup<>();
Array<Recipe> recipes = new Array<Recipe>();
for(Section sec : Section.values()){
recipes.clear();
Recipe.getBy(sec, recipes);
maxcol = Math.max((int)((float)recipes.size/rows+1), maxcol);
}
for(Section sec : Section.values()){
recipes.clear();
Recipe.getBy(sec, recipes);
ImageButton button = new ImageButton("icon-"+sec.name(), "toggle");
add(button).size(size).height(size+8);
button.getImageCell().size(40).padBottom(4);
group.add(button);
Table table = new Table();
int i = 0;
for(Recipe r : recipes){
ImageButton image = new ImageButton(Draw.region(r.result.name()), "select");
image.clicked(()->{
main.recipe = r;
});
table.add(image).size(size+8).pad(4);
image.getImageCell().size(size);
image.update(()->{
image.setChecked(main.recipe == r);
image.setDisabled(!main.hasItems(r.requirements));
});
if(i % rows == rows-1)
table.row();
i++;
String description = r.result.description();
if(r.result.ammo != null){
description += "\n[SALMON]Ammo: " + r.result.ammo.name();
}
Table tiptable = new Table();
tiptable.background("button");
tiptable.add("[PURPLE]" + r.result.name(), 0.75f).left().padBottom(2f);
ItemStack[] req = r.requirements;
for(ItemStack s : req){
tiptable.row();
tiptable.add("[YELLOW]" + s.amount + "x " + s.item.name(), 0.5f).left();
}
tiptable.row();
tiptable.add().size(10);
tiptable.row();
tiptable.add("[ORANGE]" + description).left();
tiptable.pad(10f);
Tooltip tip = new Tooltip(tiptable);
tip.setInstant(true);
image.addListener(tip);
}
//additional padding
for(int j = 0; j < maxcol - (int)((float)recipes.size/rows+1); j ++){
table.row();
table.add().size(size);
}
table.setVisible(()->{
return button.isChecked();
});
stack.add(table);
}
row();
add(stack).colspan(3);
/*
for(Recipe r : Recipe.values()){
Image image = new Image(Draw.region(r.result.name()));
new button(r.result.name(), ()->{
get().add(image).size(40);
if(i % rows == rows-1)
row();
i++;
/*
new button(r.result.name(), () -> {
main.recipe = r;
}){{
get().clearChildren();
@ -84,98 +221,131 @@ public class UI extends SceneModule<Moment>{
ItemStack[] req = r.requirements;
for(ItemStack stack : req){
table.row();
table.add("[YELLOW]"+stack.amount +"x " +stack.item.name()).left();
table.add("[YELLOW]" + stack.amount + "x " + stack.item.name()).left();
}
get().getLabel().setAlignment(Align.left);
String description = r.result.description();
if(r.result.ammo != null){
description += "\n[SALMON]Ammo: " + r.result.ammo.name();
}
Table tiptable = new Table();
tiptable.background("button");
tiptable.add("[PURPLE]"+r.result.name(), 0.5f).left().padBottom(2f);
tiptable.add("[PURPLE]" + r.result.name(), 0.5f).left().padBottom(2f);
tiptable.row();
tiptable.add("[ORANGE]"+description).left();
tiptable.pad(8f);
tiptable.add("[ORANGE]" + description).left();
tiptable.pad(10f);
Tooltip tip = new Tooltip(tiptable);
tip.setInstant(true);
get().addListener(tip);
Recipe current = r;
get().update(()->{
get().update(() -> {
get().setDisabled(!main.hasItems(current.requirements));
//get().setTouchable(!main.hasItems(current.requirements) ? Touchable.disabled : Touchable.enabled);
});
}}.width(220f);
}}.width(234f);
row();
//row();
}
get().pad(20f);
*/
get().pad(10f);
}}.right().bottom();
get().setVisible(play);
}}.end();
new table(){{
atop();
aleft();
itemtable = new table().top().left().get();
itemtable.background("button");
get().setVisible(play);
}}.end();
//wave table...
new table(){{
atop();
aright();
new table(){{
get().background("button");
new label("Wave 1"){{
get().setFontScale(1f);
get().update(()->{
get().setText("[YELLOW]Wave " + Moment.i.wave);
});
}}.left();
row();
new label("Time"){{
get().update(()->{
get().setText(Enemy.amount > 0 ?
Enemy.amount+" Enemies remaining" : "New wave in " + (int)(main.wavetime/60f));
});
}}.minWidth(150);
get().pad(8);
}};
get().background("button");
new label("Wave 1"){{
get().setFontScale(1f);
get().update(() -> {
get().setText("[YELLOW]Wave " + Moment.i.wave);
});
}}.left();
row();
new label("Time"){{
get().update(() -> {
get().setText(Enemy.amount > 0 ? Enemy.amount + " Enemies remaining" : "New wave in " + (int) (main.wavetime / 60f));
});
}}.minWidth(150);
get().pad(12);
}};
get().setVisible(play);
}}.end();
//menu table
new table(){{
float w = 200;
new button("Play", () -> {
main.play();
}).width(w);
row();
new button("Settings", () -> {
prefs.show(scene);
}).width(w);
row();
new button("Controls", () -> {
keys.show(scene);
}).width(w);
row();
new button("About", () -> {
about.show(scene);
}).width(w);
get().setVisible(nplay);
}};
updateItems();
build.end();
}
public void updateItems(){
itemtable.clear();
for(Item stack : main.items.keys()){
Image image = new Image(Draw.region("icon-" + stack.name()));
Label label = new Label(""+ main.items.get(stack));
Label label = new Label("" + main.items.get(stack));
label.setFontScale(1f);
itemtable.add(image).size(32);
itemtable.add(label);
itemtable.row();
}
}
float roundx(){
return Mathf.round2(UGraphics.mouseWorldPos().x, TileType.tilesize);
}

View File

@ -1,34 +1,54 @@
package io.anuke.moment.resource;
import static io.anuke.moment.resource.Section.*;
import com.badlogic.gdx.utils.Array;
import io.anuke.moment.world.TileType;
public enum Recipe{
stonewall(TileType.stonewall, stack(Item.stone, 4)),
ironwall(TileType.ironwall, stack(Item.iron, 4)),
drill(TileType.stonedrill, stack(Item.stone, 5)),
irondrill(TileType.irondrill, stack(Item.stone, 30)),
coaldrill(TileType.coaldrill, stack(Item.stone, 30), stack(Item.iron, 30)),
conveyor(TileType.conveyor, stack(Item.stone, 1)),
fastconveyor(TileType.steelconveyor, stack(Item.steel, 1)),
router(TileType.router, stack(Item.stone, 3)),
smelter(TileType.smelter, stack(Item.stone, 40), stack(Item.iron, 40)),
healturret(TileType.healturret, stack(Item.iron, 20)),
turret(TileType.turret, stack(Item.stone, 4)),
dturret(TileType.doubleturret, stack(Item.stone, 6)),
machineturret(TileType.machineturret, stack(Item.iron, 10), stack(Item.stone, 6)),
shotgunturret(TileType.shotgunturret, stack(Item.iron, 10), stack(Item.steel, 8)),
flameturret(TileType.flameturret, stack(Item.iron, 12), stack(Item.steel, 12)),
sniperturret(TileType.sniperturret, stack(Item.iron, 15), stack(Item.steel, 20));
stonewall(distribution, TileType.stonewall, stack(Item.stone, 4)),
ironwall(distribution, TileType.ironwall, stack(Item.iron, 4)),
steelwall(distribution, TileType.steelwall, stack(Item.steel, 4)),
conveyor(distribution, TileType.conveyor, stack(Item.stone, 1)),
fastconveyor(distribution, TileType.steelconveyor, stack(Item.steel, 1)),
router(distribution, TileType.router, stack(Item.stone, 3)),
healturret(defense, TileType.healturret, stack(Item.iron, 30)),
megahealturret(defense, TileType.megahealturret, stack(Item.iron, 30), stack(Item.steel, 30)),
turret(defense, TileType.turret, stack(Item.stone, 4)),
dturret(defense, TileType.doubleturret, stack(Item.stone, 6)),
machineturret(defense, TileType.machineturret, stack(Item.iron, 10), stack(Item.stone, 6)),
shotgunturret(defense, TileType.shotgunturret, stack(Item.iron, 10), stack(Item.steel, 8)),
flameturret(defense, TileType.flameturret, stack(Item.iron, 12), stack(Item.steel, 12)),
sniperturret(defense, TileType.sniperturret, stack(Item.iron, 15), stack(Item.steel, 20)),
drill(production, TileType.stonedrill, stack(Item.stone, 5)),
irondrill(production, TileType.irondrill, stack(Item.stone, 30)),
coaldrill(production, TileType.coaldrill, stack(Item.stone, 30), stack(Item.iron, 30)),
smelter(production, TileType.smelter, stack(Item.stone, 40), stack(Item.iron, 40));
public TileType result;
public ItemStack[] requirements;
public Section section;
private Recipe(TileType result, ItemStack... requirements){
private Recipe(Section section, TileType result, ItemStack... requirements){
this.result = result;
this.requirements = requirements;
this.section = section;
}
private static ItemStack stack(Item item, int amount){
return new ItemStack(item, amount);
}
public static Array<Recipe> getBy(Section section, Array<Recipe> r){
for(Recipe recipe : Recipe.values()){
if(recipe.section == section)
r.add(recipe);
}
return r;
}
}

View File

@ -0,0 +1,5 @@
package io.anuke.moment.resource;
public enum Section{
defense, production, distribution;
}

View File

@ -22,16 +22,16 @@ public enum TileType{
public void draw(Tile tile){
}
},
grass, stone, dirt, iron, coal, dirtblock(true), stoneblock(true), stonewall(true, true){
{
health = 50;
}
},
ironwall(true, true){
{
health = 80;
}
},
grass,
stone,
dirt,
iron,
coal,
dirtblock(true),
stoneblock(true),
stonewall(true, true){{health = 50;}},
ironwall(true, true){{health = 80;}},
steelwall(true, true){{health = 110;}},
stonedrill(true, true){
public void update(Tile tile){
@ -416,7 +416,7 @@ public enum TileType{
healturret(true, true, false){
{
range = 30;
reload = 30f;
reload = 40f;
health = 50;
}
@ -447,17 +447,65 @@ public enum TileType{
float x = tile.worldx(), y = tile.worldy();
float x2 = tile.entity.link.x, y2 = tile.entity.link.y;
Draw.color(Hue.rgb(138, 244, 138, (MathUtils.sin(Timers.time() / 2f) + 1f) / 15f));
Draw.color(Hue.rgb(138, 244, 138, (MathUtils.sin(Timers.time()) + 1f) / 14f));
Draw.alpha(0.3f);
Draw.thickness(4f);
Draw.line(x, y, x2, y2);
Draw.thickness(2f);
Draw.circle(x2, y2, 2f);
Draw.rect("circle", x2, y2, 7f, 7f);
Draw.alpha(1f);
Draw.thickness(2f);
Draw.line(x, y, x2, y2);
Draw.thickness(1f);
Draw.circle(x2, y2, 1f);
Draw.rect("circle", x2, y2, 5f, 5f);
Draw.clear();
}
Draw.rect(name(), tile.worldx(), tile.worldy(), tile.entity.rotation - 90);
}
public String description(){
return "Heals nearby tiles.";
}
},
megahealturret(true, true, false){
{
range = 30;
reload = 25f;
health = 60;
}
public void update(Tile tile){
tile.entity.link = findTileTarget(tile, range);
if(tile.entity.link != null){
tile.entity.rotation = tile.entity.angleTo(tile.entity.link);
if(Timers.get(tile, reload)){
tile.entity.link.health++;
}
}
}
public void draw(Tile tile){
Draw.rect("block", tile.worldx(), tile.worldy());
}
public void drawOver(Tile tile){
if(tile.entity.link != null){
float x = tile.worldx(), y = tile.worldy();
float x2 = tile.entity.link.x, y2 = tile.entity.link.y;
Draw.color(Hue.rgb(132, 242, 242, (MathUtils.sin(Timers.time()) + 1f) / 13f));
Draw.alpha(0.3f);
Draw.thickness(4f);
Draw.line(x, y, x2, y2);
Draw.thickness(2f);
Draw.rect("circle", x2, y2, 7f, 7f);
Draw.alpha(1f);
Draw.thickness(2f);
Draw.line(x, y, x2, y2);
Draw.thickness(1f);
Draw.rect("circle", x2, y2, 5f, 5f);
Draw.clear();
}
Draw.rect(name(), tile.worldx(), tile.worldy(), tile.entity.rotation - 90);
@ -558,7 +606,8 @@ public enum TileType{
Array<SolidEntity> array = Entities.getNearby(tile.worldx(), tile.worldy(), 100);
for(Entity e : array){
if(e == tile.entity) continue;
if(e instanceof TileEntity && ((TileEntity) e).health < ((TileEntity) e).tile.block().health){
float ndst = Vector2.dst(tile.worldx(), tile.worldy(), e.x, e.y);
if(ndst < range && (closest == null || ndst < dst)){