Skip to content

Commit

Permalink
Pew pew mit dem lieben @ole1711
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSchroschk committed Jan 22, 2024
1 parent 09ca3cf commit b16fbd6
Show file tree
Hide file tree
Showing 11 changed files with 176 additions and 16 deletions.
34 changes: 34 additions & 0 deletions images/laserRed01.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://25aj8wr271hw"
path="res://.godot/imported/laserRed01.png-5a5873855acc43ef628a72927c9f1245.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://images/laserRed01.png"
dest_files=["res://.godot/imported/laserRed01.png-5a5873855acc43ef628a72927c9f1245.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
5 changes: 5 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ input_left_mouse={
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(240, 17),"global_position":Vector2(244, 58),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}
shoot={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":76,"key_label":0,"unicode":108,"echo":false,"script":null)
]
}

[rendering]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[ext_resource type="Script" path="res://addons/pronto/behaviors/ExportBehavior.gd" id="1"]
[ext_resource type="Script" path="res://prototypes/game-shadows-of-surveillance/game-shadows-of-surveillance.gd" id="1_odj0a"]
[ext_resource type="PackedScene" uid="uid://dyvtu758xr2so" path="res://scenes/level.tscn" id="3_3xcs3"]
[ext_resource type="PackedScene" uid="uid://c7nvl73x1g6ig" path="res://scenes/level2.tscn" id="4_bj0tv"]
[ext_resource type="PackedScene" uid="uid://nrfvxvrpbboq" path="res://scenes/level2.tscn" id="4_bj0tv"]

[node name="Game" type="Node2D"]
script = ExtResource("1_odj0a")
Expand Down
Binary file modified prototypes/game-shadows-of-surveillance/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions scenes/bullet.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
extends Area2D
var speed = 501
var dir
var muzzle

# Called when the node enters the scene tree for the first time.
func _ready():
self.global_position = muzzle
global_rotation = dir.angle()

func setup(direction, muzzlePos):
dir = direction
muzzle = muzzlePos

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
position += dir * speed * delta
print(position)

func _on_body_entered(body):
if body.is_in_group("enemy"):
body.queue_free()
if !body.is_in_group("player"):
queue_free()
20 changes: 20 additions & 0 deletions scenes/bullet.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[gd_scene load_steps=4 format=3 uid="uid://boqn5yw22tcj7"]

[ext_resource type="Texture2D" uid="uid://cooutieukq5fx" path="res://scenes/laserRed01.png" id="1_4l3sk"]
[ext_resource type="Script" path="res://scenes/bullet.gd" id="1_qyq4p"]

[sub_resource type="RectangleShape2D" id="RectangleShape2D_cn71r"]
size = Vector2(57, 10)

[node name="Bullet" type="Area2D"]
script = ExtResource("1_qyq4p")

[node name="Sprite2D" type="Sprite2D" parent="."]
rotation = 1.5708
texture = ExtResource("1_4l3sk")

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(-2.5, 0)
shape = SubResource("RectangleShape2D_cn71r")

[connection signal="body_entered" from="." to="." method="_on_body_entered"]
Binary file added scenes/laserRed01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions scenes/laserRed01.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://cooutieukq5fx"
path="res://.godot/imported/laserRed01.png-b302d850d42954e1f780d8ff592eed6a.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://scenes/laserRed01.png"
dest_files=["res://.godot/imported/laserRed01.png-b302d850d42954e1f780d8ff592eed6a.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
20 changes: 7 additions & 13 deletions scenes/level2.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
[gd_scene load_steps=17 format=3 uid="uid://c7nvl73x1g6ig"]
[gd_scene load_steps=16 format=3 uid="uid://nrfvxvrpbboq"]

[ext_resource type="Texture2D" uid="uid://ej3g6agmjf0x" path="res://scenes/6.png" id="1_sm2i4"]
[ext_resource type="PackedScene" uid="uid://4j52c4ucysq5" path="res://Tilemap.tscn" id="2_7nhks"]
[ext_resource type="PackedScene" path="res://Tilemap.tscn" id="2_7nhks"]
[ext_resource type="TileSet" uid="uid://dp12gfueqor5q" path="res://tileset.tres" id="3_34qp1"]
[ext_resource type="PackedScene" uid="uid://dxp4mlvvs0g2" path="res://scenes/player2.tscn" id="3_lafji"]
[ext_resource type="Texture2D" uid="uid://ch6w3mr4w7ueu" path="res://LightSprite.png" id="5_kwx7m"]
[ext_resource type="Texture2D" uid="uid://dn1e3hoeursu" path="res://scenes/drone.png" id="6_yo0f5"]
[ext_resource type="Texture2D" uid="uid://bm7wvm5fbbm4b" path="res://scenes/drone.png" id="6_yo0f5"]
[ext_resource type="Script" path="res://addons/pronto/behaviors/MoveBehavior.gd" id="7_ooonu"]
[ext_resource type="Script" path="res://addons/pronto/behaviors/AlwaysBehavior.gd" id="8_wsqn2"]
[ext_resource type="Script" path="res://addons/pronto/helpers/ConnectionScript.gd" id="9_6atqn"]
Expand Down Expand Up @@ -69,14 +68,7 @@ color = Color(0, 0, 0, 1)
[node name="TileMap" parent="." instance=ExtResource("2_7nhks")]
tile_set = ExtResource("3_34qp1")
[node name="Player2" parent="." instance=ExtResource("3_lafji")]
position = Vector2(313, 419)
[node name="Flashlight" type="PointLight2D" parent="Player2" groups=["light"]]
position = Vector2(3.87598, 31.0078)
texture = ExtResource("5_kwx7m")
[node name="Enemy" type="CharacterBody2D" parent="."]
[node name="Enemy" type="CharacterBody2D" parent="." groups=["enemy"]]
position = Vector2(637, 360)
scale = Vector2(0.274855, 0.274855)
Expand All @@ -96,6 +88,8 @@ acceleration = 20.0
[node name="AlwaysBehavior" type="Node2D" parent="Enemy/MoveBehavior"]
position = Vector2(-35.1815, 14.5728)
scale = Vector2(1, 1)
script = ExtResource("8_wsqn2")
metadata/pronto_connections = [SubResource("Resource_81ot0")]
[node name="Player2" parent="." instance=ExtResource("3_lafji")]
position = Vector2(297, 304)
39 changes: 39 additions & 0 deletions scenes/player2.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
extends CharacterBody2D

const bullet_scene = preload("res://scenes/bullet.tscn")
const SPEED = 300.0
const JUMP_VELOCITY = -400.0

# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")


func _physics_process(delta):
# Add the gravity.
if not is_on_floor():
velocity.y += gravity * delta

# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY

# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction = Input.get_axis("ui_left", "ui_right")
if direction:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)

move_and_slide()

if Input.is_action_just_pressed("shoot"):
print("pew pew")
shoot()


func shoot():
var b = bullet_scene.instantiate()
var direction = (get_global_mouse_position() - global_position).normalized()
b.setup(direction, $Marker2D.global_position)
owner.add_child(b)
14 changes: 12 additions & 2 deletions scenes/player2.tscn
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
[gd_scene load_steps=4 format=3 uid="uid://dxp4mlvvs0g2"]
[gd_scene load_steps=6 format=3 uid="uid://dxp4mlvvs0g2"]

[ext_resource type="Script" path="res://addons/pronto/behaviors/PlatformerControllerBehavior.gd" id="1_vl5ip"]
[ext_resource type="Script" path="res://scenes/player2.gd" id="1_vm6uo"]
[ext_resource type="Texture2D" uid="uid://chiivrwridrdd" path="res://scenes/ole_player2.jpg" id="2_0d7en"]
[ext_resource type="Texture2D" uid="uid://ca3jyudumrgbl" path="res://LightSprite.png" id="4_qvm50"]

[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_7cbuj"]
height = 248.062

[node name="Player2" type="CharacterBody2D"]
[node name="Player2" type="CharacterBody2D" groups=["player"]]
scale = Vector2(0.258, 0.258)
script = ExtResource("1_vm6uo")

[node name="OlePlayer2" type="Sprite2D" parent="."]
position = Vector2(7.75194, 7.75195)
Expand All @@ -23,3 +26,10 @@ shape = SubResource("CapsuleShape2D_7cbuj")
position = Vector2(576, 324)
script = ExtResource("1_vl5ip")
player = 1

[node name="Marker2D" type="Marker2D" parent="."]
position = Vector2(-54.2636, 38.7597)

[node name="Flashlight" type="PointLight2D" parent="." groups=["light"]]
position = Vector2(3.87598, 31.0078)
texture = ExtResource("4_qvm50")

0 comments on commit b16fbd6

Please sign in to comment.