mirror of https://github.com/profan/ld-39-jam.git
when the going gets tough, the coding gets hard
This commit is contained in:
parent
9fe981b3a6
commit
b9d22ba27f
|
@ -16,14 +16,14 @@ func it_changed(new_pos):
|
|||
func _draw():
|
||||
var vp_rect = get_viewport().get_rect()
|
||||
# draw player in center
|
||||
var p_mw = (vp_rect.size.x / 2) - 1
|
||||
var p_mh = (vp_rect.size.y / 2) - 1
|
||||
var p_mw = ((vp_rect.size.x / 2) - 1) + 32
|
||||
var p_mh = ((vp_rect.size.y / 2) - 1) + 32
|
||||
draw_rect(Rect2(p_mw, p_mh, 2, 2), Color(0, 1, 0))
|
||||
for e in entities:
|
||||
var ent = e.get_ref()
|
||||
var ent_pos = ent.get_global_pos()
|
||||
var s_mw = vp_rect.size.x / 2
|
||||
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)
|
||||
var s_y = s_mh + (ent_pos.y / vp_rect.size.y) - (cam_pos.y / vp_rect.size.y)
|
||||
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))
|
|
@ -11,7 +11,7 @@ func _ready():
|
|||
set_fixed_process(true)
|
||||
tex_frame.set_texture(render_target.get_render_target_texture())
|
||||
render_target.init(entities)
|
||||
tex_frame.set_pos(Vector2(32, 32))
|
||||
set_pos(Vector2(32, 32))
|
||||
|
||||
func register_entity(e):
|
||||
entities.append(weakref(e))
|
||||
|
|
|
@ -27,7 +27,6 @@ script/script = ExtResource( 2 )
|
|||
|
||||
[node name="TextureFrame" type="TextureFrame" parent="Minimap"]
|
||||
|
||||
rect/scale = Vector2( 2, 2 )
|
||||
focus/ignore_mouse = true
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 2
|
||||
|
|
Loading…
Reference in New Issue