-
Notifications
You must be signed in to change notification settings - Fork 2
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
6 changed files
with
95 additions
and
3 deletions.
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,46 @@ | ||
extends Node2D | ||
|
||
|
||
const DynamicBgPattern = preload("res://bg/dynamic_bg/dynamic_bg_pattern/dynamic_bg_pattern.tscn") | ||
|
||
|
||
const WIDTH = 1920 / 4 | ||
const HEIGHT = 1080 / 4 | ||
|
||
const W_STEP := 60 | ||
const H_STEP := 6 | ||
|
||
var VELOCITY = 30 * Vector2.from_angle(-atan(2)) | ||
|
||
func spawn(x_offset, y_offset): | ||
var pat_x = -WIDTH + x_offset | ||
var pat_y = HEIGHT + y_offset | ||
|
||
while pat_x < WIDTH + 50: | ||
var new_pattern = DynamicBgPattern.instantiate() | ||
|
||
new_pattern.position = Vector2(pat_x, pat_y) | ||
new_pattern.velocity = VELOCITY | ||
add_child(new_pattern) | ||
|
||
pat_x += W_STEP | ||
pat_y += H_STEP | ||
|
||
|
||
func _ready(): | ||
var x_offset = 0 | ||
var y_offset = 0 | ||
while HEIGHT + y_offset + (WIDTH / W_STEP) * H_STEP > -50: | ||
spawn(x_offset, y_offset) | ||
x_offset += $Timer.wait_time * VELOCITY.x | ||
x_offset -= int(x_offset / W_STEP) * W_STEP | ||
y_offset += $Timer.wait_time * VELOCITY.y | ||
print(y_offset) | ||
|
||
# Called every frame. 'delta' is the elapsed time since the previous frame. | ||
func _process(delta): | ||
pass | ||
|
||
|
||
func _on_timer_timeout(): | ||
spawn(0, 0) |
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,13 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://d3geq38s5fjc6"] | ||
|
||
[ext_resource type="Script" path="res://bg/dynamic_bg/dynamic_bg.gd" id="1_g3cph"] | ||
|
||
[node name="DynamicBg" type="Node2D"] | ||
z_index = -4096 | ||
script = ExtResource("1_g3cph") | ||
|
||
[node name="Timer" type="Timer" parent="."] | ||
wait_time = 2.0 | ||
autostart = true | ||
|
||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] |
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,14 @@ | ||
extends Node2D | ||
|
||
|
||
var velocity : Vector2 | ||
|
||
|
||
func _ready(): | ||
$Word1.set_word("=*"[randi_range(0, 1)]) | ||
$Word2.set_word("DPb"[randi_range(0, 2)]) | ||
|
||
func _process(delta): | ||
position += velocity * delta | ||
if position.x > 1920 / 4 + 70 or position.y < -70: | ||
queue_free() |
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,14 @@ | ||
[gd_scene load_steps=3 format=3 uid="uid://dkm7ljv01kwma"] | ||
|
||
[ext_resource type="Script" path="res://bg/dynamic_bg/dynamic_bg_pattern/dynamic_bg_pattern.gd" id="1_hrrmh"] | ||
[ext_resource type="PackedScene" uid="uid://cvx7wowcbfo0r" path="res://objects/word/word.tscn" id="2_7jm3n"] | ||
|
||
[node name="DynamicBgPattern" type="Node2D"] | ||
modulate = Color(1, 1, 1, 0.12549) | ||
script = ExtResource("1_hrrmh") | ||
|
||
[node name="Word1" parent="." instance=ExtResource("2_7jm3n")] | ||
position = Vector2(-6, 0) | ||
|
||
[node name="Word2" parent="." instance=ExtResource("2_7jm3n")] | ||
position = Vector2(6, 0) |
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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
[gd_scene load_steps=2 format=3 uid="uid://c17fbsiogbgo1"] | ||
[gd_scene load_steps=3 format=3 uid="uid://c17fbsiogbgo1"] | ||
|
||
[ext_resource type="PackedScene" uid="uid://c07co5p46apu7" path="res://objects/main_menu/main_menu.tscn" id="1_fk6j6"] | ||
[ext_resource type="PackedScene" uid="uid://d3geq38s5fjc6" path="res://bg/dynamic_bg/dynamic_bg.tscn" id="2_8k4il"] | ||
|
||
[node name="Main" type="Node"] | ||
|
||
[node name="MainMenu" parent="." instance=ExtResource("1_fk6j6")] | ||
|
||
[node name="Bg" type="Node" parent="."] | ||
|
||
[node name="DynamicBg" parent="Bg" instance=ExtResource("2_8k4il")] |