@@ -297,7 +297,7 @@ LAST_SCENE = null
297
297
DEFAULT_FONT = null
298
298
TEXT_SIZE_MULTIPLIER = 1
299
299
300
- class Entity {
300
+ class Entity {
301
301
constructor ( options = null ) {
302
302
if ( ! ( 'type' in options ) ) {
303
303
options [ 'type' ] = 'entity'
@@ -347,7 +347,7 @@ class Entity {
347
347
options [ 'parent' ] = LAST_SCENE
348
348
}
349
349
else {
350
- this . parent = scene
350
+ this . parent = scene
351
351
}
352
352
if ( DEFAULT_FONT ) {
353
353
this . font = DEFAULT_FONT
@@ -441,7 +441,7 @@ class Entity {
441
441
}
442
442
else {
443
443
this . el . style . visibility = 'hidden'
444
- }
444
+ }
445
445
446
446
this . _enabled = value
447
447
@@ -1038,7 +1038,7 @@ class StateHandler {
1038
1038
settings [ key ] = value
1039
1039
}
1040
1040
if ( ! camera . overlay ) {
1041
- camera . overlay = new Entity ( { parent :camera , name :'overlay' , color :color . black , alpha :0 , z :- 99 , scale :[ 1.1 , aspect_ratio * 1.1 ] } )
1041
+ camera . overlay = new Entity ( { parent :camera , name :'overlay' , color :color . black , alpha :0 , z :- 99 , scale :[ 1.1 , aspect_ratio * 1.1 ] } )
1042
1042
// print('make new overlay')
1043
1043
}
1044
1044
this . states = settings [ 'states' ]
@@ -1148,7 +1148,12 @@ class RainbowSlider extends Entity {
1148
1148
1149
1149
update ( ) {
1150
1150
if ( this . active && mouse . left && mouse . hovered_entity === this ) {
1151
- this . value = int ( ( mouse . point [ 0 ] + .5 + ( 1 / this . max ) ) * this . max )
1151
+ if ( this . rotation == 0 ) {
1152
+ this . value = int ( ( mouse . point [ 0 ] + .5 + ( 1 / this . max ) ) * this . max )
1153
+ }
1154
+ else if ( this . rotation == - 90 ) {
1155
+ this . value = int ( ( mouse . point [ 1 ] + .5 + ( 1 / this . max ) ) * this . max )
1156
+ }
1152
1157
}
1153
1158
}
1154
1159
@@ -1221,6 +1226,10 @@ function _mousedown(event) {
1221
1226
}
1222
1227
document . addEventListener ( 'pointerdown' , _mousedown )
1223
1228
1229
+ const click_animation = new Entity ( { 'parent' :camera . ui , 'scale' :.2 , 'z' :- 100 , 'texture' :'impact_effect.gif' , 'enabled' :false , 'alpha' :.5 } )
1230
+ if ( ! click_animation . texture ) {
1231
+ click_animation . visible = false
1232
+ }
1224
1233
1225
1234
time_of_press = 0
1226
1235
function _handle_mouse_click ( e ) {
@@ -1237,6 +1246,9 @@ function _handle_mouse_click(e) {
1237
1246
if ( element_hit && entity ) {
1238
1247
if ( entity . on_click ) {
1239
1248
entity . on_click ( )
1249
+ click_animation . xy = mouse . position
1250
+ click_animation . enabled = True
1251
+ click_animation . texture = 'impact_effect.gif'
1240
1252
}
1241
1253
if ( entity . draggable ) {
1242
1254
window_position = _game_window . getBoundingClientRect ( )
@@ -1305,6 +1317,7 @@ function _onmousemove(event) {
1305
1317
var x = event . clientX - rect . left ; //x position within the element.
1306
1318
var y = event . clientY - rect . top ; //y position within the element.
1307
1319
mouse . point = [ ( x / rect . width ) - .5 , .5 - ( y / rect . height ) ]
1320
+ // print(mouse.point)
1308
1321
}
1309
1322
element_hit = document . elementFromPoint ( event . pageX - window . pageXOffset , event . pageY - window . pageYOffset ) ;
1310
1323
_entity = entities [ element_hit . entity_index ]
0 commit comments