<commit_before>
extends KinematicBody2D

const GRAVITY = 1000.0
const MOVE_SPEED = 260.0
const JUMP_FORCE = 230.0
const POINT = 1
const INIT_MOVE_DIRECTION = Vector2(1, 1)

var score = 0
var _velocity = Vector2()
var _motion = Vector2()
var is_grounded = false
var _move_direction = INIT_MOVE_DIRECTION
var current_floor = 1
var start_points = [
		Matrix32(0.0, Vector2(0, 80)),
		Matrix32(0.0, Vector2(715, 220)),
		Matrix32(0.0, Vector2(0, 360))
	]

onready var tree = get_tree()
onready var root = tree.get_root()
onready var global = root.get_node("/root/global")
onready var _sprite = get_node("Sprite")
onready var _raycast = get_node("RayCast2D")
onready var _health = get_node("health")
onready var _sound_player = get_node("SamplePlayer")

func _ready():
	set_process(true)
	set_fixed_process(true)

func _process(delta):
	if global.is_game_over():
		_sprite.hide()
	else:
		_sprite.show()

func _fixed_process(delta):
	is_grounded = _raycast.is_colliding()
	_velocity.y += _move_direction.y * GRAVITY * delta
	
	if not global.is_game_over():
		_velocity.x = _move_direction.x * MOVE_SPEED
	else:
		_velocity.x = 0.0
	
	if is_grounded:
		if Input.is_action_pressed("jump"):
			_velocity.y = -JUMP_FORCE
			_sound_player.play("jump")
	
	_motion = _velocity * delta
	_motion = move(_motion)
	
	if is_colliding():
		var n = get_collision_normal()
		_motion = n.slide(_motion)
		_velocity = n.slide(_velocity)
		move(_motion)

func change_move_direction_h():
	_move_direction.x *= -1

func reset_move_direction():
	_move_direction = INIT_MOVE_DIRECTION

func _on_Area2D_area_enter( area ):
	if area.get_groups().has("switch_side_trigger"):
		global.add_score(POINT)<commit_msg>Avoid playing sound of the player's jump when player is no longer alive.<commit_after>
extends KinematicBody2D

const GRAVITY = 1000.0
const MOVE_SPEED = 260.0
const JUMP_FORCE = 230.0
const POINT = 1
const INIT_MOVE_DIRECTION = Vector2(1, 1)

var score = 0
var _velocity = Vector2()
var _motion = Vector2()
var is_grounded = false
var _move_direction = INIT_MOVE_DIRECTION
var current_floor = 1
var start_points = [
		Matrix32(0.0, Vector2(0, 80)),
		Matrix32(0.0, Vector2(715, 220)),
		Matrix32(0.0, Vector2(0, 360))
	]

onready var tree = get_tree()
onready var root = tree.get_root()
onready var global = root.get_node("/root/global")
onready var _sprite = get_node("Sprite")
onready var _raycast = get_node("RayCast2D")
onready var _health = get_node("health")
onready var _sound_player = get_node("SamplePlayer")

func _ready():
	set_process(true)
	set_fixed_process(true)

func _process(delta):
	if global.is_game_over():
		_sprite.hide()
	else:
		_sprite.show()

func _fixed_process(delta):
	if _health.is_alive():
		is_grounded = _raycast.is_colliding()
		_velocity.y += _move_direction.y * GRAVITY * delta
	
		if not global.is_game_over():
			_velocity.x = _move_direction.x * MOVE_SPEED
		else:
			_velocity.x = 0.0
	
		if is_grounded:
			if Input.is_action_pressed("jump"):
				_velocity.y = -JUMP_FORCE
				_sound_player.play("jump")
	
		_motion = _velocity * delta
		_motion = move(_motion)
	
		if is_colliding():
			var n = get_collision_normal()
			_motion = n.slide(_motion)
			_velocity = n.slide(_velocity)
			move(_motion)

func change_move_direction_h():
	_move_direction.x *= -1

func reset_move_direction():
	_move_direction = INIT_MOVE_DIRECTION

func _on_Area2D_area_enter( area ):
	if area.get_groups().has("switch_side_trigger"):
		global.add_score(POINT)
{'fraction_non_alphanumeric': 0.11316397228637413, 'fraction_numerical': 0.03175519630484989, 'mean_word_length': 4.943396226415095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '879117', 'n_tokens_mistral': 1462, 'n_tokens_neox': 1312, 'n_words': 293}