-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
f002f1f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Deployed on https://pr-568--little-mario.netlify.app