mirror of https://github.com/profan/ld-39-jam.git
terrible
This commit is contained in:
parent
b9d22ba27f
commit
8d72de944e
|
@ -18,6 +18,9 @@ func _ready():
|
|||
rot_vel = deg2rad(floor(rand_range(1, max_rot_vel)))
|
||||
set_fixed_process(true)
|
||||
|
||||
func type():
|
||||
return "Asteroid"
|
||||
|
||||
func wrap(v, v_min, v_max):
|
||||
if v < v_min:
|
||||
return v_max - 1
|
||||
|
|
|
@ -10,7 +10,7 @@ var current_threshold = 5
|
|||
var spawn_delay = 1 # seconds
|
||||
|
||||
# deps
|
||||
onready var map = get_parent().get_node("Minimap")
|
||||
onready var map = get_parent().get_node("MinimapControl")
|
||||
|
||||
func _ready():
|
||||
set_fixed_process(true)
|
||||
|
|
|
@ -9,7 +9,7 @@ func _ready():
|
|||
func init(ents):
|
||||
entities = ents
|
||||
|
||||
func it_changed(new_pos):
|
||||
func it_changed():
|
||||
cam_pos = get_tree().get_root().get_node("Game/Player").get_pos()
|
||||
update()
|
||||
|
||||
|
@ -26,4 +26,8 @@ func _draw():
|
|||
var s_mh = vp_rect.size.y / 2
|
||||
var s_x = s_mw + (ent_pos.x / vp_rect.size.x) - (cam_pos.x / vp_rect.size.x) + 32
|
||||
var s_y = s_mh + (ent_pos.y / vp_rect.size.y) - (cam_pos.y / vp_rect.size.y) + 32
|
||||
draw_rect(Rect2(s_x, s_y, 2, 2), Color(1, 1, 1))
|
||||
|
||||
if ent.type() == "Asteroid":
|
||||
draw_rect(Rect2(s_x, s_y, 2, 2), Color(1, 1, 1))
|
||||
elif ent.type() == "PowerStation":
|
||||
draw_rect(Rect2(s_x, s_y, 4, 4), Color(0, 0, 1))
|
19
Game.tscn
19
Game.tscn
|
@ -1,17 +1,24 @@
|
|||
[gd_scene load_steps=5 format=1]
|
||||
[gd_scene load_steps=6 format=1]
|
||||
|
||||
[ext_resource path="res://Minimap.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://AsteroidSpawner.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Player.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://raw/space.png" type="Texture" id=4]
|
||||
[ext_resource path="res://PowerStation.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://Player.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://raw/space.png" type="Texture" id=5]
|
||||
|
||||
[node name="Game" type="Node"]
|
||||
|
||||
[node name="Minimap" parent="." instance=ExtResource( 1 )]
|
||||
[node name="MinimapControl" parent="." instance=ExtResource( 1 )]
|
||||
|
||||
[node name="AsteroidSpawner" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource( 3 )]
|
||||
[node name="PowerStations" type="Node" parent="."]
|
||||
|
||||
[node name="PowerStation" parent="PowerStations" instance=ExtResource( 3 )]
|
||||
|
||||
transform/pos = Vector2( 119.085, -182.303 )
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource( 4 )]
|
||||
|
||||
transform/pos = Vector2( 92.7742, 71.7896 )
|
||||
|
||||
|
@ -36,7 +43,7 @@ motion/mirroring = Vector2( 0, 0 )
|
|||
|
||||
[node name="Sprite" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
|
||||
|
||||
texture = ExtResource( 4 )
|
||||
texture = ExtResource( 5 )
|
||||
region = true
|
||||
region_rect = Rect2( 0, 0, 8192, 8192 )
|
||||
|
||||
|
|
|
@ -28,15 +28,9 @@ func collect_entities():
|
|||
func _fixed_process(delta):
|
||||
collect_entities()
|
||||
|
||||
func _get_camera_center():
|
||||
var vtrans = get_canvas_transform()
|
||||
var top_left = -vtrans.get_origin() / vtrans.get_scale()
|
||||
var vsize = get_viewport_rect().size
|
||||
return top_left + 0.5*vsize/vtrans.get_scale()
|
||||
|
||||
func _draw():
|
||||
if entities.size() > 0:
|
||||
render_target.render_target_clear()
|
||||
render_target.it_changed(_get_camera_center())
|
||||
render_target.it_changed()
|
||||
# gc the shit out of em
|
||||
collect_entities()
|
|
@ -8,5 +8,5 @@ func _ready():
|
|||
func init(ents):
|
||||
child.init(ents)
|
||||
|
||||
func it_changed(new_pos):
|
||||
child.it_changed(new_pos)
|
||||
func it_changed():
|
||||
child.it_changed()
|
|
@ -6,8 +6,9 @@ icon="res://icon.png"
|
|||
|
||||
[input]
|
||||
|
||||
player_attack_secondary=[mbutton(0, 2)]
|
||||
player_move_forwards=[key(Up), key(W), jaxis(0, 2)]
|
||||
player_move_backwards=[key(S), key(Down), jaxis(0, 3)]
|
||||
player_attack=[mbutton(0, 1)]
|
||||
player_attack_primary=[mbutton(0, 1)]
|
||||
player_move_left=[key(A), key(Left)]
|
||||
player_move_right=[key(D), key(Right)]
|
||||
|
|
Loading…
Reference in New Issue