Skip to content

Commit

Permalink
blug (#566)
Browse files Browse the repository at this point in the history
  • Loading branch information
Woahsea authored Jul 26, 2022
1 parent 137ab2b commit f002f1f
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 1 deletion.
24 changes: 24 additions & 0 deletions scenes/friends/Blug.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[gd_scene load_steps=5 format=2]

[ext_resource path="res://scenes/ui/TextTrigger.tscn" type="PackedScene" id=1]
[ext_resource path="res://sprites/NPCs/blug.png" type="Texture" id=2]
[ext_resource path="res://scripts/friends/Blug.gd" type="Script" id=3]

[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 512, 512 )

[node name="Blug" type="Area2D"]
collision_layer = 0
collision_mask = 64
script = ExtResource( 3 )

[node name="TextTrigger" parent="." instance=ExtResource( 1 )]
text = "blug"

[node name="Sprite" type="Sprite" parent="."]
scale = Vector2( 2, 2 )
texture = ExtResource( 2 )

[node name="Collision" type="CollisionShape2D" parent="."]
visible = false
shape = SubResource( 1 )
6 changes: 5 additions & 1 deletion scenes/levels/Hub.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=10 format=2]

[ext_resource path="res://scenes/levels/TileSet.tres" type="TileSet" id=1]
[ext_resource path="res://scenes/SpawnPoint.tscn" type="PackedScene" id=2]
Expand All @@ -8,6 +8,7 @@
[ext_resource path="res://scripts/levels/Hub.gd" type="Script" id=6]
[ext_resource path="res://sprites/Coin_Gems/star.png" type="Texture" id=7]
[ext_resource path="res://scenes/ui/Themes/Default/DefaultFont.tres" type="DynamicFont" id=8]
[ext_resource path="res://scenes/friends/Blug.tscn" type="PackedScene" id=9]

[node name="Hub" type="TileMap"]
tile_set = ExtResource( 1 )
Expand Down Expand Up @@ -107,5 +108,8 @@ scroll_active = false
[node name="TutorialPortalPos" type="Position2D" parent="."]
position = Vector2( 96, 160 )

[node name="Blug" parent="." instance=ExtResource( 9 )]
position = Vector2( -128, 192 )

[editable path="Instructions"]
[editable path="PictureFrameStar"]
26 changes: 26 additions & 0 deletions scripts/friends/Blug.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
extends Area2D


const SPEED = 2
const DIST = 64

onready var _sprite := $Sprite


func _ready():
$Collision.visible = true


func _physics_process(delta):
var playPos = Vector2()
for body in get_overlapping_bodies():
if body is Player:
playPos = body.position

if playPos.x > position.x + DIST:
position.x += SPEED
_sprite.scale.x = 2
elif playPos.x < position.x - DIST:
position.x -= SPEED
_sprite.scale.x = -2

Binary file added sprites/NPCs/blug.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions sprites/NPCs/blug.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/blug.png-38488233af05dcfda10ef6d9407d5c49.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://sprites/NPCs/blug.png"
dest_files=[ "res://.import/blug.png-38488233af05dcfda10ef6d9407d5c49.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

1 comment on commit f002f1f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.