made launch rigid more generic
This commit is contained in:
parent
65a4fd8742
commit
40e10663d6
7 changed files with 158 additions and 19 deletions
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=22 format=2]
|
||||
[gd_scene load_steps=21 format=2]
|
||||
|
||||
[ext_resource path="res://objects/player/player.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://tilesets/t_cave.tres" type="TileSet" id=2]
|
||||
|
@ -16,7 +16,6 @@
|
|||
[ext_resource path="res://objects/environment/falling_block/falling_block.tscn" type="PackedScene" id=14]
|
||||
[ext_resource path="res://objects/environment/moving_platform/moving_platform.tscn" type="PackedScene" id=15]
|
||||
[ext_resource path="res://objects/respawn_point.tscn" type="PackedScene" id=16]
|
||||
[ext_resource path="res://objects/player/arrow_projectile.tscn" type="PackedScene" id=17]
|
||||
[ext_resource path="res://objects/enemy/mine.tscn" type="PackedScene" id=18]
|
||||
[ext_resource path="res://objects/enemy/explosion.tscn" type="PackedScene" id=19]
|
||||
[ext_resource path="res://objects/enemy/tin.tscn" type="PackedScene" id=20]
|
||||
|
@ -66,7 +65,7 @@ position = Vector2( 216, 168 )
|
|||
position = Vector2( 216, 168 )
|
||||
|
||||
[node name="Arrow" parent="." instance=ExtResource( 13 )]
|
||||
position = Vector2( 184, 163 )
|
||||
position = Vector2( 104, 120 )
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 104, 110 )
|
||||
|
@ -122,24 +121,16 @@ position = Vector2( 88, 160 )
|
|||
position = Vector2( 0, -4 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="ArrowProjectile" parent="." instance=ExtResource( 17 )]
|
||||
position = Vector2( 128, 128 )
|
||||
|
||||
[node name="ArrowProjectile2" parent="." instance=ExtResource( 17 )]
|
||||
position = Vector2( 198, 130 )
|
||||
speed = 0.0
|
||||
|
||||
[node name="Mine" parent="." instance=ExtResource( 18 )]
|
||||
position = Vector2( 232, 144 )
|
||||
|
||||
[node name="Explosion" parent="." instance=ExtResource( 19 )]
|
||||
position = Vector2( 160, 128 )
|
||||
position = Vector2( 112, 40 )
|
||||
|
||||
[node name="Tin" parent="." instance=ExtResource( 20 )]
|
||||
position = Vector2( 80, 48 )
|
||||
position = Vector2( 168, 96 )
|
||||
up_boundary = 3.0
|
||||
down_boundary = 3.0
|
||||
move_direction = 1
|
||||
|
||||
[node name="Tin2" parent="." instance=ExtResource( 20 )]
|
||||
position = Vector2( 32, 72 )
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
[ext_resource path="res://graphics/enemy/boss/scrump_gore/eyestalk.png" type="Texture" id=1]
|
||||
[ext_resource path="res://graphics/enemy/boss/scrump_gore/eye.png" type="Texture" id=2]
|
||||
[ext_resource path="res://graphics/enemy/boss/scrump_gore/headupper.png" type="Texture" id=3]
|
||||
[ext_resource path="res://objects/enemy/boss/boss1_gore.gd" type="Script" id=4]
|
||||
[ext_resource path="res://scripts/launch_rigid.gd" type="Script" id=4]
|
||||
[ext_resource path="res://graphics/enemy/boss/scrump_gore/headlower.png" type="Texture" id=5]
|
||||
[ext_resource path="res://graphics/enemy/boss/scrump_gore/tentacle5.png" type="Texture" id=6]
|
||||
[ext_resource path="res://graphics/enemy/boss/scrump_gore/tentacle3.png" type="Texture" id=7]
|
||||
|
|
|
@ -27,3 +27,7 @@ func _physics_process(delta):
|
|||
direction *= -1
|
||||
if position.y <= startpos.y - (up_boundary):
|
||||
direction *= -1
|
||||
|
||||
func die():
|
||||
.die()
|
||||
Game.instance_node(load("res://objects/enemy/tin_die.tscn"),position.x,position.y,get_parent())
|
||||
|
|
9
objects/enemy/tin_die.gd
Normal file
9
objects/enemy/tin_die.gd
Normal file
|
@ -0,0 +1,9 @@
|
|||
extends Node2D
|
||||
|
||||
|
||||
func _ready():
|
||||
$AnimatedSprite.playing = true
|
||||
|
||||
|
||||
func _on_AnimatedSprite_animation_finished():
|
||||
$AnimatedSprite.queue_free()
|
132
objects/enemy/tin_die.tscn
Normal file
132
objects/enemy/tin_die.tscn
Normal file
|
@ -0,0 +1,132 @@
|
|||
[gd_scene load_steps=13 format=2]
|
||||
|
||||
[ext_resource path="res://graphics/enemy/explosion_small.png" type="Texture" id=1]
|
||||
[ext_resource path="res://objects/enemy/tin_die.gd" type="Script" id=2]
|
||||
[ext_resource path="res://graphics/enemy/tin.png" type="Texture" id=3]
|
||||
[ext_resource path="res://scripts/launch_rigid.gd" type="Script" id=4]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=1]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 0, 0, 16, 16 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=2]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 16, 0, 16, 16 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=3]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 32, 0, 16, 16 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=4]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 48, 0, 16, 16 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=5]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 64, 0, 16, 16 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=6]
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 80, 0, 16, 16 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=7]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ],
|
||||
"loop": false,
|
||||
"name": "default",
|
||||
"speed": 20.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=8]
|
||||
extents = Vector2( 2, 2 )
|
||||
|
||||
[node name="TinDie" type="Node2D"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
frames = SubResource( 7 )
|
||||
|
||||
[node name="Topleft" type="RigidBody2D" parent="."]
|
||||
mass = 2.0
|
||||
script = ExtResource( 4 )
|
||||
impulse_max = 200
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="Topleft"]
|
||||
position = Vector2( -2, -2 )
|
||||
texture = ExtResource( 3 )
|
||||
hframes = 2
|
||||
vframes = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Topleft"]
|
||||
position = Vector2( -2, -2 )
|
||||
shape = SubResource( 8 )
|
||||
|
||||
[node name="Timer" type="Timer" parent="Topleft"]
|
||||
wait_time = 5.0
|
||||
autostart = true
|
||||
|
||||
[node name="TopRight" type="RigidBody2D" parent="."]
|
||||
mass = 2.0
|
||||
script = ExtResource( 4 )
|
||||
impulse_max = 200
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="TopRight"]
|
||||
position = Vector2( 3, -2 )
|
||||
texture = ExtResource( 3 )
|
||||
hframes = 2
|
||||
vframes = 2
|
||||
frame = 1
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="TopRight"]
|
||||
position = Vector2( 2, -2 )
|
||||
shape = SubResource( 8 )
|
||||
|
||||
[node name="Timer" type="Timer" parent="TopRight"]
|
||||
wait_time = 5.3
|
||||
autostart = true
|
||||
|
||||
[node name="BottomLeft" type="RigidBody2D" parent="."]
|
||||
mass = 2.0
|
||||
script = ExtResource( 4 )
|
||||
impulse_max = 200
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="BottomLeft"]
|
||||
position = Vector2( -2, 3 )
|
||||
texture = ExtResource( 3 )
|
||||
hframes = 2
|
||||
vframes = 2
|
||||
frame = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="BottomLeft"]
|
||||
position = Vector2( -2, 2 )
|
||||
shape = SubResource( 8 )
|
||||
|
||||
[node name="Timer" type="Timer" parent="BottomLeft"]
|
||||
wait_time = 5.5
|
||||
autostart = true
|
||||
|
||||
[node name="BottomRight" type="RigidBody2D" parent="."]
|
||||
position = Vector2( 3, 3 )
|
||||
mass = 2.0
|
||||
script = ExtResource( 4 )
|
||||
impulse_max = 200
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="BottomRight"]
|
||||
texture = ExtResource( 3 )
|
||||
hframes = 2
|
||||
vframes = 2
|
||||
frame = 3
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="BottomRight"]
|
||||
position = Vector2( -1, -1 )
|
||||
shape = SubResource( 8 )
|
||||
|
||||
[node name="Timer" type="Timer" parent="BottomRight"]
|
||||
wait_time = 5.8
|
||||
autostart = true
|
||||
|
||||
[connection signal="animation_finished" from="AnimatedSprite" to="." method="_on_AnimatedSprite_animation_finished"]
|
||||
[connection signal="timeout" from="Topleft/Timer" to="Topleft" method="queue_free"]
|
||||
[connection signal="timeout" from="TopRight/Timer" to="TopRight" method="queue_free"]
|
||||
[connection signal="timeout" from="BottomLeft/Timer" to="BottomLeft" method="queue_free"]
|
||||
[connection signal="timeout" from="BottomRight/Timer" to="BottomRight" method="queue_free"]
|
|
@ -108,7 +108,7 @@ jump={
|
|||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
restart={
|
||||
debug_restart={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":82,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
|
@ -167,6 +167,11 @@ pause={
|
|||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
restart={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":82,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
extends RigidBody2D
|
||||
|
||||
#MINUMUM AND MAXIMUM IMPULSE
|
||||
var impulse_min = 100
|
||||
var impulse_max = 300
|
||||
export var impulse_min = 100
|
||||
export var impulse_max = 300
|
||||
|
||||
var rot = 0
|
||||
|
||||
func _ready():
|
||||
#SHOOT OFF AT A RANDOM DIRECTION
|
||||
var impulse_strength = rand_range(impulse_min, impulse_max)
|
Loading…
Add table
Add a link
Reference in a new issue