mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-12 11:55:53 +00:00
Reisen
This commit is contained in:
parent
6fbbe7ee4c
commit
6d49455b3e
9 changed files with 118 additions and 7 deletions
|
|
@ -8,6 +8,7 @@ radius = 2.23607
|
|||
|
||||
[node name="Bullet" type="Area2D"]
|
||||
script = ExtResource("1_jvxw3")
|
||||
Speed = 500.0
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
|
|
@ -18,3 +19,7 @@ shape = SubResource("CircleShape2D_jxptd")
|
|||
|
||||
[node name="Node2D" type="Node2D" parent="."]
|
||||
editor_description = "Player Bullet"
|
||||
|
||||
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
|
||||
|
||||
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]
|
||||
|
|
|
|||
|
|
@ -63,17 +63,18 @@ animations = [{
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_bbnjh"]
|
||||
radius = 7.0
|
||||
|
||||
[node name="Fragola" type="Node2D"]
|
||||
|
||||
[node name="Fragola" type="RigidBody2D" parent="."]
|
||||
[node name="Fragola" type="RigidBody2D"]
|
||||
collision_layer = 4
|
||||
collision_mask = 7
|
||||
mass = 0.03
|
||||
gravity_scale = 0.0
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="Fragola"]
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_7uyln")
|
||||
animation = &"idle"
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Fragola"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_bbnjh")
|
||||
|
||||
[node name="Fragola" type="Node2D" parent="."]
|
||||
|
|
|
|||
45
Scenes/reisen.tscn
Normal file
45
Scenes/reisen.tscn
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://cxmcqehjjy82j"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://b4ynnb14mb4uq" path="res://Sprites/Reisen.png" id="1_lfysk"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rf4l1"]
|
||||
atlas = ExtResource("1_lfysk")
|
||||
region = Rect2(0, 0, 8, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6mmet"]
|
||||
atlas = ExtResource("1_lfysk")
|
||||
region = Rect2(8, 0, 8, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_okgvq"]
|
||||
atlas = ExtResource("1_lfysk")
|
||||
region = Rect2(16, 0, 8, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_8n5rt"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_rf4l1")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6mmet")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_okgvq")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_car73"]
|
||||
size = Vector2(6, 9)
|
||||
|
||||
[node name="CharacterBody2D" type="CharacterBody2D"]
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_8n5rt")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, 0.5)
|
||||
shape = SubResource("RectangleShape2D_car73")
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://bv451a8wgty4u"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://bv451a8wgty4u"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bghghp5ep4w2j" path="res://Scenes/player.tscn" id="2_8mh54"]
|
||||
[ext_resource type="PackedScene" uid="uid://cxmcqehjjy82j" path="res://Scenes/reisen.tscn" id="3_8k37m"]
|
||||
[ext_resource type="PackedScene" uid="uid://rp4jhx0tuh24" path="res://Scenes/fragola.tscn" id="4_s7wq6"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qui05"]
|
||||
|
|
@ -60,3 +61,6 @@ position = Vector2(62, 10)
|
|||
|
||||
[node name="Player" parent="." instance=ExtResource("2_8mh54")]
|
||||
position = Vector2(-7, -15)
|
||||
|
||||
[node name="CharacterBody2D" parent="." instance=ExtResource("3_8k37m")]
|
||||
position = Vector2(78, -15)
|
||||
|
|
|
|||
|
|
@ -2,8 +2,13 @@ using Godot;
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
public partial class Bullet : RigidBody2D
|
||||
public partial class Bullet : Area2D
|
||||
{
|
||||
[Export]
|
||||
public float Speed = 1900f;
|
||||
|
||||
private Vector2 _direction = Vector2.Right;
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
|
|
@ -13,6 +18,16 @@ public partial class Bullet : RigidBody2D
|
|||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
|
||||
this.Position += ((float) (Speed * delta) * _direction);
|
||||
}
|
||||
|
||||
private void _on_visible_on_screen_notifier_2d_screen_exited()
|
||||
{
|
||||
Debug.WriteLine("Destroy bullet out of screen");
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public partial class PlayerMovement : CharacterBody2D
|
|||
{
|
||||
if (Input.IsActionJustPressed("shoot"))
|
||||
{
|
||||
Debug.WriteLine("Shoot");
|
||||
Bullet bullet = BulletScene.Instantiate<Bullet>();
|
||||
Owner.AddChild(bullet);
|
||||
bullet.Transform = Muzzle.GlobalTransform;
|
||||
|
|
|
|||
BIN
Sprites/Reisen.aseprite
(Stored with Git LFS)
Normal file
BIN
Sprites/Reisen.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Sprites/Reisen.png
(Stored with Git LFS)
Normal file
BIN
Sprites/Reisen.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/Reisen.png.import
Normal file
34
Sprites/Reisen.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b4ynnb14mb4uq"
|
||||
path="res://.godot/imported/Reisen.png-8f337c31d7f03a02d98c68db42ec7137.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Reisen.png"
|
||||
dest_files=["res://.godot/imported/Reisen.png-8f337c31d7f03a02d98c68db42ec7137.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
Loading…
Add table
Add a link
Reference in a new issue