This commit is contained in:
Jonathan Herrewijnen 2020-10-06 13:26:46 +02:00
commit ce2887b89f
4 changed files with 144 additions and 0 deletions

28
Scenes/Inventory.gd Normal file
View File

@ -0,0 +1,28 @@
extends Node2D
#func _draw():
# var center = Vector2(200, 200)
# var radius = 80
# var angle_from = 75
# var angle_to = 195
# var color = Color(1.0, 0.0, 0.0)
# draw_circle_arc(center, radius, angle_from, angle_to, color)
#
#func draw_circle_arc(center, radius, angle_from, angle_to, color):
# var nb_points = 32
# var points_arc = PoolVector2Array()
#
# for i in range(nb_points + 1):
# var angle_point = deg2rad(angle_from + i * (angle_to-angle_from) / nb_points - 90)
# points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius)
#
# for index_point in range(nb_points):
# draw_line(points_arc[index_point], points_arc[index_point + 1], color)
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

34
Scenes/Inventory.tscn Normal file
View File

@ -0,0 +1,34 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://pictures/gui/backgrounds/inventory/inventory_background.png" type="Texture" id=1]
[ext_resource path="res://Scenes/Inventory_Script.gd" type="Script" id=2]
[ext_resource path="res://Scenes/Inventory.gd" type="Script" id=3]
[ext_resource path="res://Scenes/TextureRect2.gd" type="Script" id=4]
[node name="Inventory" type="Node2D"]
z_index = 1
script = ExtResource( 3 )
[node name="TextureRect" type="TextureRect" parent="."]
margin_right = 40.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="inventory_background" type="Sprite" parent="TextureRect"]
position = Vector2( 617.053, 299.964 )
scale = Vector2( 3.08457, 1.99938 )
z_index = -1
texture = ExtResource( 1 )
script = ExtResource( 2 )
[node name="TextureRect2" type="TextureRect" parent="TextureRect/inventory_background"]
margin_left = -200.045
margin_top = -150.028
margin_right = -160.045
margin_bottom = -110.028
script = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -0,0 +1,41 @@
extends Sprite
var items = [1,2,3]
func draw_circle_arc(center, radius, angle_from, angle_to, color):
var nb_points = 32
var points_arc = PoolVector2Array()
for i in range(nb_points + 1):
var angle_point = deg2rad(angle_from + i * (angle_to-angle_from) / nb_points - 90)
points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius)
for index_point in range(nb_points):
draw_line(points_arc[index_point], points_arc[index_point + 1], color)
func draw_circle_arc_poly(center, radius, angle_from, angle_to, color):
var nb_points = 32
var points_arc = PoolVector2Array()
points_arc.push_back(center)
var colors = PoolColorArray([color])
for i in range(nb_points + 1):
var angle_point = deg2rad(angle_from + i * (angle_to - angle_from) / nb_points - 90)
points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius)
draw_polygon(points_arc, colors)
func _draw():
var center = Vector2(200, 200)
var radius = 80
var angle_from = 75
var angle_to = 195
var color = Color(1.0, 0.0, 0.0)
draw_circle_arc_poly(center, radius, angle_from, angle_to, color)
# Called when the node enters the scene tree for the first time.
func _ready():
_draw()
# for x in range(len(items)):
# _draw()
pass # Replace with function body.

41
Scenes/TextureRect2.gd Normal file
View File

@ -0,0 +1,41 @@
extends TextureRect
var items = [1,2,3]
func draw_circle_arc(center, radius, angle_from, angle_to, color):
var nb_points = 32
var points_arc = PoolVector2Array()
for i in range(nb_points + 1):
var angle_point = deg2rad(angle_from + i * (angle_to-angle_from) / nb_points - 90)
points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius)
for index_point in range(nb_points):
draw_line(points_arc[index_point], points_arc[index_point + 1], color)
func draw_circle_arc_poly(center, radius, angle_from, angle_to, color):
var nb_points = 32
var points_arc = PoolVector2Array()
points_arc.push_back(center)
var colors = PoolColorArray([color])
for i in range(nb_points + 1):
var angle_point = deg2rad(angle_from + i * (angle_to - angle_from) / nb_points - 90)
points_arc.push_back(center + Vector2(cos(angle_point), sin(angle_point)) * radius)
draw_polygon(points_arc, colors)
func _draw():
var center = Vector2(200, 200)
var radius = 80
var angle_from = 75
var angle_to = 195
var color = Color(1.0, 0.0, 0.0)
draw_circle_arc_poly(center, radius, angle_from, angle_to, color)
# Called when the node enters the scene tree for the first time.
func _ready():
_draw()
# for x in range(len(items)):
# _draw()
pass # Replace with function body.