character run
This commit is contained in:
parent
08d00d2ad3
commit
4f091e788b
4 changed files with 17 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -10,3 +10,4 @@ Midori in the Magic School.x86_64
|
|||
Midori in the Magic School.arm64
|
||||
Midori in the Magic School.apk.idsig
|
||||
Midori in the Magic School.pck
|
||||
android/
|
||||
|
|
1
android
1
android
|
@ -1 +0,0 @@
|
|||
Subproject commit 7b067f338b30c1f498ac4eaa61d1a2a855f29f26
|
|
@ -80,7 +80,7 @@ ui_down={
|
|||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
button0={
|
||||
shoot={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":75,"key_label":0,"unicode":107,"location":0,"echo":false,"script":null)
|
||||
|
@ -104,6 +104,11 @@ Pause={
|
|||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":4,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
run={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":85,"key_label":0,"unicode":117,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[internationalization]
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ var bpress = false
|
|||
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
|
||||
var weakness
|
||||
var speciality
|
||||
var rboost = 1
|
||||
|
||||
func _ready():
|
||||
add_to_group("players")
|
||||
|
@ -64,7 +65,7 @@ func _physics_process(delta):
|
|||
#var velocity = Vector2.ZERO
|
||||
#if Global.live == 1 || (xm == 0 && ym == 0):
|
||||
if speed != null:
|
||||
velocity = (Vector2.RIGHT.rotated(rotation) * speed * xm * delta)-Vector2.UP.rotated(rotation) * speed * ym * delta
|
||||
velocity = (Vector2.RIGHT.rotated(rotation) * speed * xm * delta * rboost)-Vector2.UP.rotated(rotation) * speed * ym * delta * rboost
|
||||
#origmpos = get_viewport().get_mouse_position()
|
||||
#if Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) != 0:
|
||||
# velocity = Vector2.UP.rotated(rotation) * -400 * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y)
|
||||
|
@ -116,9 +117,15 @@ func _input(event):
|
|||
ym = -1
|
||||
if Input.is_action_pressed("ui_down"):
|
||||
ym = 1
|
||||
if Input.is_action_pressed("run"):
|
||||
rboost = 4
|
||||
elif Global.gamepad > 0:
|
||||
rboost = (Input.get_joy_axis(0,JOY_AXIS_TRIGGER_RIGHT) + 1)*2
|
||||
else:
|
||||
rboost = 1
|
||||
if Input.is_action_pressed("schar") && (Input.is_action_just_released("ui_up") || Input.is_action_just_released("ui_down") || Input.is_action_just_released("ui_left") || Input.is_action_just_released("ui_right")):
|
||||
_charswitch()
|
||||
if Input.is_action_just_pressed("button0") && !bpress && Global.live == 1:
|
||||
if Input.is_action_just_pressed("shoot") && !bpress && Global.live == 1:
|
||||
bpress = true
|
||||
var bullet
|
||||
if Global.debug:
|
||||
|
@ -138,7 +145,7 @@ func _input(event):
|
|||
new_pbullet.position = Vector2(position.x + rposition.x, position.y + rposition.y)
|
||||
if new_pbullet.position.x > 0 && new_pbullet.position.y > 0 && new_pbullet.position.x < 1280 && new_pbullet.position.y < 720:
|
||||
get_parent().add_child(new_pbullet)
|
||||
elif Input.is_action_just_released("button0") && bpress:
|
||||
elif Input.is_action_just_released("shoot") && bpress:
|
||||
bpress = false
|
||||
|
||||
func _charinit():
|
||||
|
|
Loading…
Reference in a new issue