Skip to content

Commit 9ff2920

Browse files
committed
added click animation back in. can be change by setting mouse.click_animation='something.gif'.
1 parent d2837a9 commit 9ff2920

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

taptapir.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,11 +1266,11 @@ mouse = {x:0, y:0, position:[0,0], left:false, middle:false, pressure:0.0, hover
12661266
}
12671267
}
12681268

1269-
1270-
// const click_animation = new Entity({'parent':camera.ui, 'scale':.2, 'z':-100, 'texture':'impact_effect.gif', 'enabled':false, 'alpha':.5})
1271-
// if (!click_animation.texture) {
1272-
// click_animation.visible = false
1273-
// }
1269+
mouse.click_animation = ''
1270+
mouse.click_animation_entity = new Entity({'parent':camera.ui, 'scale':.2, 'z':-100, 'enabled':false, 'alpha':.5})
1271+
if (!mouse.click_animation) {
1272+
mouse.click_animation_entity.visible = false
1273+
}
12741274

12751275
time_of_press = 0
12761276
function _handle_mouse_click(e) {
@@ -1287,11 +1287,12 @@ function _handle_mouse_click(e) {
12871287
if (element_hit && entity) {
12881288
if (entity.on_click) {
12891289
entity.on_click()
1290-
// if (click_animation.texture) {
1291-
// click_animation.xy = mouse.position
1292-
// click_animation.enabled = True
1293-
// click_animation.texture = 'impact_effect.gif'
1294-
// }
1290+
if (mouse.click_animation) {
1291+
mouse.click_animation_entity.xy = mouse.position
1292+
mouse.click_animation_entity.enabled = True
1293+
mouse.click_animation_entity.texture = mouse.click_animation
1294+
print('play click anim')
1295+
}
12951296
}
12961297
if (entity.draggable) {
12971298
window_position = _game_window.getBoundingClientRect()

0 commit comments

Comments
 (0)