Skip to content

Commit

Permalink
Small reshuffle
Browse files Browse the repository at this point in the history
  • Loading branch information
Acvarium committed Apr 23, 2017
1 parent 798e491 commit 15290ae
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 57 deletions.
4 changes: 2 additions & 2 deletions engine.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ icon="res://icon.png"

[display]

width=1600
height=1000
width=800
height=600
driver="GLES2"

[image_loader]
Expand Down
76 changes: 27 additions & 49 deletions scenes/main.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=1]
[gd_scene load_steps=16 format=1]

[ext_resource path="res://scripts/main.gd" type="Script" id=1]
[ext_resource path="res://textures/UI/menu_button.png" type="Texture" id=2]
Expand All @@ -8,11 +8,10 @@
[ext_resource path="res://textures/UI/menu_button_arrow_right.png" type="Texture" id=6]
[ext_resource path="res://fonts/f01.fnt" type="BitmapFont" id=7]
[ext_resource path="res://textures/v.png" type="Texture" id=8]
[ext_resource path="res://textures/stars6.jpg" type="Texture" id=9]
[ext_resource path="res://objects/vehicle.tscn" type="PackedScene" id=10]
[ext_resource path="res://textures/target.png" type="Texture" id=11]
[ext_resource path="res://objects/vehicle.tscn" type="PackedScene" id=9]
[ext_resource path="res://textures/target.png" type="Texture" id=10]

[sub_resource type="Animation" id=5]
[sub_resource type="Animation" id=1]

resource/name = "menu_appear"
length = 0.1
Expand Down Expand Up @@ -59,22 +58,22 @@ tracks/3/keys = {
"values": [ 64.0, 390.0 ]
}

[sub_resource type="ConvexPolygonShape2D" id=1]
[sub_resource type="ConvexPolygonShape2D" id=2]

custom_solver_bias = 0.0
points = Vector2Array( -50.2995, 1067.63, -100.266, -26.0879, -0.332825, -16.8348, 3.36841, 1001.01 )

[sub_resource type="ConvexPolygonShape2D" id=2]
[sub_resource type="ConvexPolygonShape2D" id=3]

custom_solver_bias = 0.0
points = Vector2Array( 1702.24, 1060.22, -50.2995, 1067.63, 3.36841, 1001.01, 1602.3, 999.154 )

[sub_resource type="ConvexPolygonShape2D" id=3]
[sub_resource type="ConvexPolygonShape2D" id=4]

custom_solver_bias = 0.0
points = Vector2Array( 1750.35, -76.0546, 1702.24, 1060.22, 1602.3, 999.154, 1600.45, -3.88049 )

[sub_resource type="ConvexPolygonShape2D" id=4]
[sub_resource type="ConvexPolygonShape2D" id=5]

custom_solver_bias = 0.0
points = Vector2Array( -105.818, -79.7558, 1750.35, -76.0546, 1600.45, -3.88049, -103.967, 1.67136 )
Expand All @@ -97,25 +96,9 @@ focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 0
margin/left = 0.0
margin/top = 0.0
margin/right = 40.0
margin/bottom = 14.0
text = "11"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1

[node name="timeSS" type="Label" parent="GUILayer"]

visibility/visible = false
focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 0
margin/left = 0.0
margin/left = 2.0
margin/top = 17.0
margin/right = 40.0
margin/right = 42.0
margin/bottom = 31.0
text = "11"
percent_visible = 1.0
Expand Down Expand Up @@ -223,7 +206,7 @@ max_lines_visible = -1
playback/process_mode = 1
playback/default_blend_time = 0.0
root/root = NodePath("..")
anims/menu_appear = SubResource( 5 )
anims/menu_appear = SubResource( 1 )
playback/active = true
playback/speed = 1.0
blend_times = [ ]
Expand Down Expand Up @@ -256,29 +239,24 @@ __meta__ = {
"_edit_lock_": true
}

[node name="TextureFrame" type="TextureFrame" parent="CanvasLayer"]
[node name="timeSS" type="Label" parent="CanvasLayer"]

visibility/opacity = 0.5
anchor/right = 1
anchor/bottom = 1
focus/ignore_mouse = true
focus/stop_mouse = true
size_flags/horizontal = 2
size_flags/vertical = 2
margin/left = -14.0
margin/top = -1.0
margin/right = -140.0
margin/bottom = -62.0
texture = ExtResource( 9 )
expand = true
stretch_mode = 2
__meta__ = {
"_edit_lock_": true
}
size_flags/vertical = 0
margin/left = 2.0
margin/top = 2.0
margin/right = 42.0
margin/bottom = 16.0
text = "11"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1

[node name="vihicles" type="Node2D" parent="."]

[node name="vehicle" parent="vihicles" instance=ExtResource( 10 )]
[node name="vehicle" parent="vihicles" instance=ExtResource( 9 )]

transform/pos = Vector2( 388.847, 304.811 )

Expand All @@ -292,23 +270,23 @@ visibility/visible = false
visibility/opacity = 0.5
transform/pos = Vector2( 576.177, 284.765 )
transform/scale = Vector2( 0.2, 0.2 )
texture = ExtResource( 11 )
texture = ExtResource( 10 )

[node name="StaticBody2D" type="StaticBody2D" parent="."]

editor/display_folded = true
visibility/visible = false
input/pickable = false
shapes/0/shape = SubResource( 1 )
shapes/0/shape = SubResource( 2 )
shapes/0/transform = Matrix32( 1, 0, 0, 1, 0, 0 )
shapes/0/trigger = true
shapes/1/shape = SubResource( 2 )
shapes/1/shape = SubResource( 3 )
shapes/1/transform = Matrix32( 1, 0, 0, 1, 0, 0 )
shapes/1/trigger = true
shapes/2/shape = SubResource( 3 )
shapes/2/shape = SubResource( 4 )
shapes/2/transform = Matrix32( 1, 0, 0, 1, 0, 0 )
shapes/2/trigger = true
shapes/3/shape = SubResource( 4 )
shapes/3/shape = SubResource( 5 )
shapes/3/transform = Matrix32( 1, 0, 0, 1, 0, 0 )
shapes/3/trigger = true
collision/layers = 1
Expand Down
14 changes: 8 additions & 6 deletions scripts/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,29 @@ var debug_vision = false
const MAX_DELTA = 0.05
var max_food_count = 100
var game_time = 0
var food_to_poison = 3
var show_menu = false

func _ready():
randomize()
set_process(true)
set_fixed_process(true)
set_process_input(true)

var screen_resolution = get_viewport().get_rect().size
max_food_count = (screen_resolution.x * screen_resolution.y / 8000)
get_node("camera").set_pos(Vector2(screen_resolution.x/2,screen_resolution.y/2))
for i in range(150):
var max_f = max_food_count / (food_to_poison + 1) * food_to_poison
for i in range(max_f):
var rand_pos = Vector2(randf() * screen_resolution.x,randf() * screen_resolution.y)
var h = randi()%10 + 1
add_piece_of_food(rand_pos, h)

for i in range(50):
for i in range(food_to_poison - max_f):
var rand_pos = Vector2(randf() * screen_resolution.x,randf() * screen_resolution.y)
var h = poison_energy #randi()%2 * 10 - 5
add_piece_of_food(rand_pos, h)

for i in range(100):
for i in range(screen_resolution.x * screen_resolution.y / 16000):
var dna = []
dna.append(randi()%10 - 5) #Притягування до їжі
dna.append(randi()%10 - 5) #Притягування до яду
Expand All @@ -60,7 +62,7 @@ func _fixed_process(delta):
var hours = int(game_time / 3600)
var minutes = int((game_time - (hours * 3600)) / 60)
var sec = int(game_time - (minutes * 60) - (hours * 3600))
get_node("GUILayer/timeSS").set_text(str("%02d" % hours) + ":" + str("%02d" % minutes) + ":" + str("%02d" % sec))
get_node("CanvasLayer/timeSS").set_text(str("%02d" % hours) + ":" + str("%02d" % minutes) + ":" + str("%02d" % sec))

# get_node("CanvasLayer/timeSS").set_text(str("%3.2f" % game_time))
var mouse_pos = get_local_mouse_pos()
Expand Down Expand Up @@ -151,7 +153,7 @@ func _eated_mess(f_name, v_name):
var screen_resolution = get_viewport().get_rect().size
var rand_pos = Vector2(randf() * screen_resolution.x,randf() * screen_resolution.y)
var h = randi()%10 + 1
if food_list.size()/4 > poison_list.size():
if (food_list.size() / food_to_poison) > poison_list.size():
h = poison_energy
if food_list.size() + poison_list.size() < max_food_count:
add_piece_of_food(rand_pos, h)
Expand Down

0 comments on commit 15290ae

Please sign in to comment.