117 lines
3.3 KiB
GDScript
117 lines
3.3 KiB
GDScript
extends Node2D
|
|
|
|
|
|
const POO = preload("res://objects/poo.tscn")
|
|
const PREY = preload("res://objects/prey.tscn")
|
|
var cameras = []
|
|
var camnumb = 0
|
|
var poo_in_rectum:float = 0
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
#cameras = [$pred/Camera,$collectioncam,$stomachcam,$rectumcam]
|
|
cameras.append({"name":"Main View","node":$pred/Camera})
|
|
cameras.append({"name":"Collection View","node":$collectioncam})
|
|
cameras.append({"name":"Stomach View","node":$stomachcam})
|
|
cameras.append({"name":"Rectum View","node":$rectumcam})
|
|
#cameras.append({"name":"TEST","node":$camcursor2})
|
|
cameras[camnumb].current = true
|
|
Global.preyzone = $preys
|
|
Global.CollectLocation = $CollectLocation.position
|
|
Global.camlabel = $UI/Control/CamLabel
|
|
#set touch controls
|
|
if not Global.settingsfile.get_value("Controls","show_touch",OS.has_touchscreen_ui_hint()):
|
|
$UI/touch.queue_free()
|
|
|
|
|
|
func _process(delta):
|
|
if Input.is_action_just_pressed("changecam") and not Input.is_action_pressed("grab"): #Input.is_mouse_button_pressed(0):
|
|
changeCam()
|
|
if Input.is_action_just_pressed("quicksummon"):
|
|
spawn_prey($pred.global_position)
|
|
#fart action
|
|
if Input.is_action_pressed("fart"):
|
|
var butt_buddies:Array = get_tree().get_nodes_in_group("rectum")
|
|
for i in butt_buddies:
|
|
if randf() < 0.02:
|
|
#remove from rectum
|
|
poo_out_prey(i)
|
|
if butt_buddies.empty() and randf() < 0.02 * poo_in_rectum:
|
|
spawn_poo($pred/flipflop/fart.global_position)
|
|
$predstuff/ShitAnimation._empty_poo()
|
|
#vomit action
|
|
if Input.is_action_pressed("vomit"):
|
|
for i in get_tree().get_nodes_in_group("stomach"):
|
|
if randf() < 0.02:
|
|
#remove from stomach
|
|
puke_out_prey(i)
|
|
#fart in the collection screen
|
|
$predstuff/ass/fart.emitting = Input.is_action_pressed("fart")
|
|
|
|
|
|
func _input(event):
|
|
if event is InputEventKey and event.is_pressed() and not event.is_echo():
|
|
var ch = char(event.scancode)
|
|
if ch.is_valid_integer() and not Input.is_action_pressed("grab"):
|
|
changeCam(int(ch)-1)
|
|
|
|
|
|
func spawn_prey(location: Vector2,type = ""):
|
|
var p = PREY.instance()
|
|
p.preytype = type
|
|
$preys.add_child(p)
|
|
p.global_position = location
|
|
|
|
|
|
func spawn_poo(location: Vector2):
|
|
var p = POO.instance()
|
|
add_child(p)
|
|
p.global_position = location
|
|
p.velocity.x = 100 * $pred/flipflop.scale.x
|
|
|
|
|
|
func changeCam(num:int = -1):
|
|
if num == -1:
|
|
camnumb += 1
|
|
else:
|
|
camnumb = num
|
|
if camnumb >= cameras.size():
|
|
camnumb = 0
|
|
cameras[camnumb]['node'].current = true
|
|
Global.camlabel.say(cameras[camnumb]['name'])
|
|
|
|
|
|
func _on_changecam_pressed():
|
|
changeCam()
|
|
|
|
|
|
func _on_ClearPB_pressed():
|
|
#delete all prey
|
|
for i in get_tree().get_nodes_in_group("prey"):
|
|
i.queue_free()
|
|
|
|
|
|
func _on_SpawnPB_pressed():
|
|
spawn_prey($pred.global_position,$UI/Control/Menu/Tabs/Prey/ItemList.prey_selected())
|
|
|
|
|
|
func poo_out_prey(prey:Prey):
|
|
prey.ungrab()
|
|
prey.scale /= (Global.collectscale * Global.insidescale)
|
|
prey.walk = 0
|
|
prey.position = $pred/flipflop/fart.global_position
|
|
prey.velocity.x = $pred/flipflop.scale.x * rand_range(50,150)
|
|
prey.velocity.y = 0
|
|
prey.launched = true
|
|
prey.remove_from_group("rectum")
|
|
|
|
|
|
func puke_out_prey(prey:Prey):
|
|
prey.ungrab()
|
|
prey.scale /= (Global.collectscale * Global.insidescale)
|
|
prey.walk = 0
|
|
prey.position = $pred/flipflop/vomit.global_position
|
|
prey.velocity.x = -$pred/flipflop.scale.x * rand_range(25,75)
|
|
prey.velocity.y = 0
|
|
prey.launched = true
|
|
prey.remove_from_group("stomach")
|