Compare commits
No commits in common. "023e749833adc3f4bd239e45896055b522a33f1d" and "78bcdb0d6fe702866352cbf6bfdc4e1705368b26" have entirely different histories.
023e749833
...
78bcdb0d6f
|
|
@ -94,11 +94,6 @@ _global_script_classes=[ {
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
"path": "res://lib/classes/movement_state_receiver.gd"
|
"path": "res://lib/classes/movement_state_receiver.gd"
|
||||||
}, {
|
}, {
|
||||||
"base": "Area2D",
|
|
||||||
"class": "Projectile",
|
|
||||||
"language": "GDScript",
|
|
||||||
"path": "res://src/classes/projectile.gd"
|
|
||||||
}, {
|
|
||||||
"base": "Resource",
|
"base": "Resource",
|
||||||
"class": "SE_StateFrame",
|
"class": "SE_StateFrame",
|
||||||
"language": "GDScript",
|
"language": "GDScript",
|
||||||
|
|
@ -157,7 +152,6 @@ _global_script_class_icons={
|
||||||
"Modifier_Receiver": "",
|
"Modifier_Receiver": "",
|
||||||
"MovementComponent": "",
|
"MovementComponent": "",
|
||||||
"Movement_StateReceiver": "",
|
"Movement_StateReceiver": "",
|
||||||
"Projectile": "",
|
|
||||||
"SE_StateFrame": "",
|
"SE_StateFrame": "",
|
||||||
"State": "",
|
"State": "",
|
||||||
"StateAnimatedActor": "",
|
"StateAnimatedActor": "",
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ extends Interactable
|
||||||
# var a = 2
|
# var a = 2
|
||||||
# var b = "text"
|
# var b = "text"
|
||||||
export var item :Resource
|
export var item :Resource
|
||||||
export var count :int = 1
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
extends Position2D
|
|
||||||
## Represents a weapon that spawns and shoots bullets.
|
|
||||||
## The Cooldown timer controls the cooldown duration between shots.
|
|
||||||
|
|
||||||
export var scene_path :Resource
|
|
||||||
export var pew_cooldown_time :float = 1.0
|
|
||||||
|
|
||||||
const BULLET_VELOCITY = 350
|
|
||||||
var projectile :Projectile #preload("res://src/Projectile.tscn")
|
|
||||||
|
|
||||||
#onready var sound_shoot = $Shoot
|
|
||||||
onready var timer = Timer.new()
|
|
||||||
onready var offset_position = Vector2(transform.origin.x, transform.origin.y)
|
|
||||||
|
|
||||||
## I don't know what type this would be
|
|
||||||
var loaded_scene
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
#projectile = load(scene_path.resource_path)
|
|
||||||
loaded_scene = load(scene_path.resource_path)
|
|
||||||
timer.autostart = false
|
|
||||||
timer.wait_time = pew_cooldown_time
|
|
||||||
timer.one_shot = true
|
|
||||||
timer.autostart = false
|
|
||||||
add_child(timer)
|
|
||||||
|
|
||||||
|
|
||||||
# This method is only called by Player.gd.
|
|
||||||
func shoot(direction = 1):
|
|
||||||
#self.set_position(Vector2(position.x * direction, position.y))
|
|
||||||
#transform.x = transform.x * direction
|
|
||||||
#Transform2D.FLIP_Y
|
|
||||||
#transform.origin.x = transform.origin.x * direction
|
|
||||||
# if direction < 0:
|
|
||||||
# var t = Transform2D()
|
|
||||||
# # Translation
|
|
||||||
# t.origin = Vector2(position.x * -1, position.y)
|
|
||||||
# transform = t
|
|
||||||
# elif direction > 0:
|
|
||||||
# var t = Transform2D()
|
|
||||||
# # Translation
|
|
||||||
# t.origin = Vector2(position.x, position.y)
|
|
||||||
# transform = t
|
|
||||||
|
|
||||||
print("Fire Debug: ", direction, " Gun position: ", position, transform.origin)
|
|
||||||
# position.x = position.x * direction #shifting position before fire was unreliable
|
|
||||||
if not timer.is_stopped():
|
|
||||||
return false
|
|
||||||
var bullet = loaded_scene.instance()
|
|
||||||
# if (direction > 0):
|
|
||||||
# bullet.global_position = global_position
|
|
||||||
# else:
|
|
||||||
# bullet.global_position = global_position - Vector2(position.x * 2, 0)
|
|
||||||
if bullet is Projectile:
|
|
||||||
bullet.global_position = global_position
|
|
||||||
|
|
||||||
#bullet.linear_velocity = Vector2(direction * BULLET_VELOCITY, 0)
|
|
||||||
|
|
||||||
bullet.set_as_toplevel(true)
|
|
||||||
add_child(bullet)
|
|
||||||
# sound_shoot.play()
|
|
||||||
timer.start()
|
|
||||||
return true
|
|
||||||
|
|
||||||
|
|
@ -4,8 +4,6 @@ var parent_request_state_change :FuncRef
|
||||||
|
|
||||||
var player_number: int = 1
|
var player_number: int = 1
|
||||||
|
|
||||||
onready var pew_machine = $"%PewMachine"
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
var state_ref :State
|
var state_ref :State
|
||||||
var state_name :String
|
var state_name :String
|
||||||
|
|
@ -165,10 +163,6 @@ func attack_secondary():
|
||||||
|
|
||||||
|
|
||||||
func _state_process_physics_attack_shoot():
|
func _state_process_physics_attack_shoot():
|
||||||
|
|
||||||
if pew_machine.timer.time_left == 0:
|
|
||||||
pew_machine.shoot()
|
|
||||||
|
|
||||||
if current_state.animation_finished == true:
|
if current_state.animation_finished == true:
|
||||||
request_state_change.call_func('idle')
|
request_state_change.call_func('idle')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,8 @@ func touch_the_thing(the_thing: Interactable) -> bool:
|
||||||
movement_state_machine.change_to_known_state('enter_right')
|
movement_state_machine.change_to_known_state('enter_right')
|
||||||
the_thing.trigger_interaction()
|
the_thing.trigger_interaction()
|
||||||
if the_thing is ItemPickup:
|
if the_thing is ItemPickup:
|
||||||
player_inventory.add_to_inventory(the_thing.item, the_thing.count)
|
player_inventory.add_to_inventory(the_thing.item)
|
||||||
#player_inventory.select_secondary(the_thing.item)
|
player_inventory.select_secondary(the_thing.item)
|
||||||
the_thing.trigger_interaction()
|
the_thing.trigger_interaction()
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=36 format=2]
|
[gd_scene load_steps=34 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://lib/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://lib/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2]
|
[ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2]
|
||||||
|
|
@ -27,8 +27,6 @@
|
||||||
[ext_resource path="res://assets_tmp/SE/tap.wav" type="AudioStream" id=25]
|
[ext_resource path="res://assets_tmp/SE/tap.wav" type="AudioStream" id=25]
|
||||||
[ext_resource path="res://assets_tmp/SE/land.wav" type="AudioStream" id=26]
|
[ext_resource path="res://assets_tmp/SE/land.wav" type="AudioStream" id=26]
|
||||||
[ext_resource path="res://src/actors/players/playerE/states/attack_punch.tres" type="Resource" id=27]
|
[ext_resource path="res://src/actors/players/playerE/states/attack_punch.tres" type="Resource" id=27]
|
||||||
[ext_resource path="res://src/PewMachine.gd" type="Script" id=28]
|
|
||||||
[ext_resource path="res://src/projectiles/MushroomPew.tscn" type="PackedScene" id=29]
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id=3]
|
[sub_resource type="Resource" id=3]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
|
|
@ -147,9 +145,3 @@ shape = SubResource( 2 )
|
||||||
[node name="Interactable_Receiver" type="Node" parent="." index="10"]
|
[node name="Interactable_Receiver" type="Node" parent="." index="10"]
|
||||||
script = ExtResource( 21 )
|
script = ExtResource( 21 )
|
||||||
interactable_parent_callback = "touch_the_thing"
|
interactable_parent_callback = "touch_the_thing"
|
||||||
|
|
||||||
[node name="PewMachine" type="Position2D" parent="." index="11"]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
position = Vector2( 10, 1.36422e-12 )
|
|
||||||
script = ExtResource( 28 )
|
|
||||||
scene_path = ExtResource( 29 )
|
|
||||||
|
|
|
||||||
|
|
@ -87,17 +87,14 @@ func select_secondary(_item :Item) -> void:
|
||||||
if _items.has(_item):
|
if _items.has(_item):
|
||||||
secondary_selection = _item
|
secondary_selection = _item
|
||||||
|
|
||||||
func add_to_inventory(_item :Item, _count :int = 1) -> int:
|
func add_to_inventory(_item :Item) -> int:
|
||||||
if _items.has(_item):
|
if _items.has(_item):
|
||||||
_items[_item] += _count
|
_items[_item] += 1
|
||||||
else:
|
else:
|
||||||
_items[_item] = _count
|
_items[_item] = 1
|
||||||
if primary_selection == null:
|
|
||||||
primary_selection = _item
|
|
||||||
elif secondary_selection == null:
|
|
||||||
secondary_selection = _item
|
|
||||||
return _items[_item]
|
return _items[_item]
|
||||||
|
|
||||||
|
|
||||||
func remove_from_inventory (_item :Item) -> int:
|
func remove_from_inventory (_item :Item) -> int:
|
||||||
if _items.has(_item):
|
if _items.has(_item):
|
||||||
if _item.consumable:
|
if _item.consumable:
|
||||||
|
|
@ -118,10 +115,6 @@ func remove_from_inventory (_item :Item) -> int:
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
func get_item_inventory_count(_item :Item) -> int:
|
|
||||||
if _items.has(_item):
|
|
||||||
return _items[_item]
|
|
||||||
return 0
|
|
||||||
|
|
||||||
func clear_item_from_inventory (_item :Item) -> void:
|
func clear_item_from_inventory (_item :Item) -> void:
|
||||||
if _items.has(_item):
|
if _items.has(_item):
|
||||||
|
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
class_name Projectile
|
|
||||||
extends Area2D
|
|
||||||
|
|
||||||
|
|
||||||
# Declare member variables here. Examples:
|
|
||||||
# var a = 2
|
|
||||||
# var b = "text"
|
|
||||||
|
|
||||||
var velocity_pps :float = 60
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta):
|
|
||||||
rotate(delta * 10)
|
|
||||||
position += Vector2(velocity_pps * delta, velocity_pps * delta)
|
|
||||||
|
|
||||||
|
|
||||||
func _on_body_entered(body):
|
|
||||||
var colliding_node = body
|
|
||||||
if colliding_node.has_node("Projectile_Receiver"):
|
|
||||||
colliding_node.get_node("Projectile_Receiver").register_interactable(self)
|
|
||||||
|
|
||||||
|
|
||||||
func _on_area_entered(area):
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
@ -123,7 +123,6 @@ tile_data = PoolIntArray( -65536, 0, 0, -65521, 0, 0, 65535, 0, 0, 16, 0, 0, 524
|
||||||
position = Vector2( 203, 38 )
|
position = Vector2( 203, 38 )
|
||||||
type_name = "item_pickup"
|
type_name = "item_pickup"
|
||||||
item = ExtResource( 8 )
|
item = ExtResource( 8 )
|
||||||
count = 10
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="ItemPickup" index="0"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="ItemPickup" index="0"]
|
||||||
shape = SubResource( 6 )
|
shape = SubResource( 6 )
|
||||||
|
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
[gd_scene load_steps=4 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://src/templates/projectile_template.tscn" type="PackedScene" id=1]
|
|
||||||
[ext_resource path="res://assets/items/mushroom_icon.png" type="Texture" id=2]
|
|
||||||
|
|
||||||
[sub_resource type="CapsuleShape2D" id=1]
|
|
||||||
radius = 6.0
|
|
||||||
height = 2.0
|
|
||||||
|
|
||||||
[node name="MushroomPew" instance=ExtResource( 1 )]
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="0"]
|
|
||||||
shape = SubResource( 1 )
|
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="." index="1"]
|
|
||||||
texture = ExtResource( 2 )
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://src/classes/projectile.gd" type="Script" id=1]
|
|
||||||
|
|
||||||
[node name="Projectile_Template" type="Area2D"]
|
|
||||||
monitorable = false
|
|
||||||
script = ExtResource( 1 )
|
|
||||||
|
|
||||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
|
||||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
|
||||||
|
|
@ -112,21 +112,7 @@ script = ExtResource( 8 )
|
||||||
[node name="PrimaryItem" type="TextureRect" parent="SelectedInventoryItems"]
|
[node name="PrimaryItem" type="TextureRect" parent="SelectedInventoryItems"]
|
||||||
margin_bottom = 16.0
|
margin_bottom = 16.0
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="SelectedInventoryItems/PrimaryItem"]
|
|
||||||
margin_right = 20.0
|
|
||||||
margin_bottom = 10.0
|
|
||||||
custom_fonts/font = ExtResource( 2 )
|
|
||||||
align = 2
|
|
||||||
valign = 2
|
|
||||||
|
|
||||||
[node name="SecondaryItem" type="TextureRect" parent="SelectedInventoryItems"]
|
[node name="SecondaryItem" type="TextureRect" parent="SelectedInventoryItems"]
|
||||||
margin_left = 4.0
|
margin_left = 4.0
|
||||||
margin_right = 4.0
|
margin_right = 4.0
|
||||||
margin_bottom = 16.0
|
margin_bottom = 16.0
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="SelectedInventoryItems/SecondaryItem"]
|
|
||||||
margin_right = 20.0
|
|
||||||
margin_bottom = 10.0
|
|
||||||
custom_fonts/font = ExtResource( 2 )
|
|
||||||
align = 2
|
|
||||||
valign = 2
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@ extends HBoxContainer
|
||||||
onready var primary_item = $PrimaryItem
|
onready var primary_item = $PrimaryItem
|
||||||
onready var secondary_item = $SecondaryItem
|
onready var secondary_item = $SecondaryItem
|
||||||
|
|
||||||
onready var _primary_item_count = $PrimaryItem/Label
|
|
||||||
onready var _secondary_item_count = $SecondaryItem/Label
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
|
|
@ -18,22 +16,10 @@ func _ready():
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
if (PlayerInfo.player_inventory.primary_selection):
|
if (PlayerInfo.player_inventory.primary_selection):
|
||||||
primary_item.texture = PlayerInfo.player_inventory.primary_selection.inventory_icon
|
primary_item.texture = PlayerInfo.player_inventory.primary_selection.inventory_icon
|
||||||
var count = PlayerInfo.player_inventory.get_item_inventory_count(PlayerInfo.player_inventory.primary_selection)
|
|
||||||
if count > 1:
|
|
||||||
_primary_item_count.text = str(count)
|
|
||||||
else:
|
|
||||||
_primary_item_count.text = ''
|
|
||||||
else:
|
else:
|
||||||
primary_item.texture = null
|
primary_item.texture = null
|
||||||
_primary_item_count.text = ''
|
|
||||||
|
|
||||||
if (PlayerInfo.player_inventory.secondary_selection):
|
if (PlayerInfo.player_inventory.secondary_selection):
|
||||||
secondary_item.texture = PlayerInfo.player_inventory.secondary_selection.inventory_icon
|
secondary_item.texture = PlayerInfo.player_inventory.secondary_selection.inventory_icon
|
||||||
var count = PlayerInfo.player_inventory.get_item_inventory_count(PlayerInfo.player_inventory.secondary_selection)
|
|
||||||
if count > 1:
|
|
||||||
_secondary_item_count.text = str(count)
|
|
||||||
else:
|
|
||||||
_secondary_item_count.text = ''
|
|
||||||
else:
|
else:
|
||||||
secondary_item.texture = null
|
secondary_item.texture = null
|
||||||
_secondary_item_count.text = ''
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user