Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends KinematicBody2D
- export (int) var velocity = 0
- export (int) var velocity_sideways = 0
- export (float) var rotation_speed = 1.5
- var acceleration = 10
- var topspeed = 25
- var team = rand_range(0,1) # 1 = red // 0 =blue
- var now_position = Vector2()
- var rotation_dir = 0
- var red_points = 0
- var blue_points = 0
- var personal_points = 0
- var red_area1_points = 0
- var blue_area1_points = 0
- var area1_hp = 0 # 100 = blue // -100 = red // 99-(-99) = gray
- var area_time_point_gain = 7.5
- var kill_point_gain = 100
- var assist_point_gain = (kill_point_gain * 0.5)
- onready var timer = get_node("timer")
- var wait = 2
- var timeout = false
- var Hunor_zseni = true
- var longness = 1
- func get_input():
- rotation_dir = 0
- now_position = Vector2()
- if Input.is_action_pressed("ui_right"):
- rotation_dir += rotation_speed
- if not Input.is_action_pressed("ui_right"):
- wait = 0.5
- timer.start()
- if (timeout == true):
- timeout = false
- if Input.is_action_pressed("ui_right"):
- for i in range(500):
- if (longness < 0.25):
- rotation_dir += 90
- velocity_sideways += (acceleration * longness)
- longness -= (longness * 0.9)
- rotation_dir -= 90
- pass
- if Input.is_action_pressed("ui_left"):
- timer.start()
- if (timeout == true):
- timeout = false
- if Input.is_action_pressed("ui_right"):
- pass
- if Input.is_action_pressed("ui_left"):
- rotation_dir -= rotation_speed
- if not Input.is_action_pressed("ui_left"):
- wait = 0.5
- timer.start()
- if (timeout == true):
- timeout = false
- if Input.is_action_pressed("ui_left"):
- for i in range(500):
- if (longness < 0.25):
- rotation_dir -= 90
- velocity_sideways += (acceleration * longness)
- longness -= (longness * 0.9)
- rotation_dir += 90
- pass
- if Input.is_action_pressed("ui_right"):
- timer.start()
- if (timeout == true):
- timeout = false
- if Input.is_action_pressed("ui_left"):
- pass
- if Input.is_action_pressed("ui_down"):
- if (velocity == -topspeed):
- return
- velocity -= (acceleration/1.5)
- if Input.is_action_pressed("ui_up"):
- if (velocity == topspeed):
- return
- velocity += acceleration
- now_position = Vector2( velocity , velocity_sideways ).rotated(rotation)
- func _physics_process(delta):
- get_input()
- rotation += (rotation_dir * rotation_speed * delta)
- move_and_slide(now_position)
- if (velocity != 0):
- if (velocity < 0):
- velocity += (acceleration/5)
- if (velocity > 0):
- velocity -= (acceleration/5)
- if _on_Area2D_area_entered(Area2D):
- area1_hp = (blue_area1_points - red_area1_points)
- if (team == 0):
- if (blue_area1_points < 100):
- wait = 0.1
- timer.start()
- if (timeout == true):
- blue_area1_points += 1
- blue_points += 0.1
- personal_points += area_time_point_gain
- return
- if (team == 1):
- if (red_area1_points < 100):
- wait = 0.1
- timer.start()
- if (timeout == true):
- red_area1_points += 1
- red_points += 0.1
- personal_points += area_time_point_gain
- return
- func _on_Timer_timeout():
- timer = true
- func _ready():
- timer.set_wait_time(wait)
- timer.start
- func _on_Area2D_area_entered(area):
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement