extends KinematicBody2D class_name Pred var velocity = Vector2(0,0) const SPEED = 320 const JUMPF = -600 const GRAVITY = 20 const SHOOTFORCE = 8 var bullet:PackedScene = preload("res://objects/bullet.tscn") var cooldown = 0 func _physics_process(delta): #do an thing if Input.is_action_pressed("walkright") and $Camera.current: velocity.x = SPEED $Sprite.flip_h = true $flipflop.scale.x = -1 elif Input.is_action_pressed("walkleft") and $Camera.current: velocity.x = -SPEED $Sprite.flip_h = false $flipflop.scale.x = 1 velocity.y += GRAVITY if Input.is_action_pressed("jump") and is_on_floor() and $Camera.current: velocity.y = JUMPF #collect $Collector/Collision.disabled = not Input.is_action_pressed("collect") #cum $flipflop/cum.emitting = Input.is_action_pressed("cum") #fart, will also remove out things in your ass $flipflop/fart.emitting = Input.is_action_pressed("fart") #vomit, will also remove out things in your stomach $flipflop/vomit.emitting = Input.is_action_pressed("vomit") #move velocity = move_and_slide(velocity.rotated(rotation),Vector2.UP).rotated(rotation) #move_and_slide(velocity,Vector2.UP) velocity.x = 0 #velocity.x = lerp(velocity.x,0,0.3) #reset y position if fall out of bounds if position.y > $Camera.limit_bottom: position.y = 0 velocity = Vector2.ZERO #shoot cooldown. actually it's more like a debounce if cooldown > 0: cooldown -= 1 func shoot(towards = get_global_mouse_position()): if $Camera.current and cooldown == 0: cooldown = 3 var b = bullet.instance() get_parent().add_child(b) b.global_position = global_position var joy = Vector2(Input.get_joy_axis(0,2),Input.get_joy_axis(0,3)) if abs(joy.x) > 0.2 or abs(joy.y) > 0.2: b.velocity = Vector2.ZERO.direction_to(joy) * SHOOTFORCE else: b.velocity = position.direction_to(towards) * SHOOTFORCE func _on_Collector_body_entered(body): if body.scale <= body.collectsize: body.draggable = true body.position = Global.CollectLocation body.tween.stop_all() body.scale *= Global.collectscale body.input_pickable = true body.grab.input_pickable = true func _unhandled_input(event): #if event is InputEventMouseButton and event.button_index == BUTTON_LEFT and event.pressed: if event.is_action_pressed("shoot"): shoot() elif event is InputEventScreenTouch and event.is_pressed(): var globpos = position + event.position - (Vector2(800,600)/2) shoot(globpos)