Add files via upload

master
Manuel González 2021-04-12 21:58:08 -04:00 committed by GitHub
parent abc7b18f08
commit 381d4b0c4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 593 additions and 0 deletions

14
Escenas/Game/game.tscn Normal file
View File

@ -0,0 +1,14 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Escenas/Game/lifes.tscn" type="PackedScene" id=1]
[ext_resource path="res://Scripts/Game/game.gd" type="Script" id=2]
[ext_resource path="res://Scripts/Game/paused.gd" type="Script" id=3]
[node name="game" type="Node2D"]
script = ExtResource( 2 )
[node name="lifes" parent="." instance=ExtResource( 1 )]
[node name="paused" type="Node2D" parent="."]
pause_mode = 2
script = ExtResource( 3 )

65
Escenas/Game/lifes.tscn Normal file

File diff suppressed because one or more lines are too long

6
Escenas/menu/menu.tscn Normal file
View File

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Scripts/Menu/menu.gd" type="Script" id=1]
[node name="Node2D" type="Node2D"]
script = ExtResource( 1 )

33
Scripts/Game/game.gd Normal file
View File

@ -0,0 +1,33 @@
extends Node2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
const max_x = 64
const max_y = 32
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if Input.is_action_just_pressed("esc"):
get_tree().quit()
if Input.is_action_pressed("clickizq"):
Glovar.ClickMouse = 1
elif Input.is_action_pressed("clickder"):
Glovar.ClickMouse = 2
else:
Glovar.ClickMouse = 0
if Glovar.PositionMouseCalculed.x >= 0 and Glovar.PositionMouseCalculed.x < max_x:
if Glovar.PositionMouseCalculed.y >= 0 and Glovar.PositionMouseCalculed.y < max_y:
if Glovar.ClickMouse == 1:
$lifes/life.set_cellv(Glovar.PositionMouseCalculed, 1)
$lifes/new_life.set_cellv(Glovar.PositionMouseCalculed, 1)
if Glovar.ClickMouse == 2:
$lifes/life.set_cellv(Glovar.PositionMouseCalculed, 0)
$lifes/new_life.set_cellv(Glovar.PositionMouseCalculed, 0)

46
Scripts/Game/lifes.gd Normal file
View File

@ -0,0 +1,46 @@
extends Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
const max_x = 64
const max_y = 32
var cel_x = 0
var cel_y = 0
var timerdead = true
# Called when the node enters the scene tree for the first time.
func _ready():
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
#Bucle
if Glovar.Paused == false:
if timerdead == true:
cel_x= 0
cel_y=0
timerdead = false
$Timer.start()
for cel_x in range(max_x):
for cel_y in range(max_y):
var around = $life.get_cell(cel_x-1,cel_y) + $life.get_cell(cel_x-1,cel_y-1) + $life.get_cell(cel_x-1,cel_y+1) + $life.get_cell(cel_x,cel_y-1) + $life.get_cell(cel_x,cel_y+1) + $life.get_cell(cel_x+1,cel_y) + $life.get_cell(cel_x+1,cel_y-1) + $life.get_cell(cel_x+1,cel_y+1)
#print(str(cel_x) + " " + str(cel_y))
#print(around)
if around == 3:
if $life.get_cell(cel_x,cel_y) == 0:
$new_life.set_cell(cel_x,cel_y,1)
if around > 3 or around < 2:
$new_life.set_cell(cel_x,cel_y,0)
#set_cell(cel_x,cel_y,0)
cel_x = 0
cel_y = 0
for cel_x in range(max_x):
for cel_y in range(max_y):
$life.set_cell(cel_x,cel_y,$new_life.get_cell(cel_x,cel_y))
func _on_Timer_timeout():
timerdead = true

25
Scripts/Game/paused.gd Normal file
View File

@ -0,0 +1,25 @@
extends Node2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var positionmouse = Vector2()
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
positionmouse = get_global_mouse_position() / 16
positionmouse = Vector2(int(positionmouse.x),int(positionmouse.y))
Glovar.PositionMouseCalculed = positionmouse
if Input.is_action_just_pressed("end"):
if Glovar.Paused == true:
Glovar.Paused = false
else:
Glovar.Paused = true

19
Scripts/Glovar.gd Normal file
View File

@ -0,0 +1,19 @@
extends Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var PositionMouseCalculed = Vector2()
var ClickMouse = 0 #0 none, 1 izq, 2 der
var Paused = false
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

17
Scripts/Menu/menu.gd Normal file
View File

@ -0,0 +1,17 @@
extends Node2D
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if Input.is_action_just_pressed("ui_down"):
get_tree().change_scene("res://Escenas/Game/life.tscn")

BIN
Textures/black.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

34
Textures/black.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/black.png-2d481fadf105b12859b5ef7f2dcaa43d.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Textures/black.png"
dest_files=[ "res://.import/black.png-2d481fadf105b12859b5ef7f2dcaa43d.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
Textures/white.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

34
Textures/white.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/white.png-1d5a98089627e59b2234dde6f9ec2646.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Textures/white.png"
dest_files=[ "res://.import/white.png-1d5a98089627e59b2234dde6f9ec2646.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

7
default_env.tres Normal file
View File

@ -0,0 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )

160
export_presets.cfg Normal file
View File

@ -0,0 +1,160 @@
[preset.0]
name="Windows Desktop"
platform="Windows Desktop"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="export/windows/GameOfLife.exe"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.0.options]
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
binary_format/64_bits=true
binary_format/embed_pck=false
custom_template/release=""
custom_template/debug=""
codesign/enable=false
codesign/identity_type=0
codesign/identity=""
codesign/password=""
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PoolStringArray( )
application/icon="res://icon/icon.ico"
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""
[preset.1]
name="Linux/X11"
platform="Linux/X11"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="export/Linux/64/GameOfLife.x86_64"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.1.options]
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
binary_format/64_bits=true
binary_format/embed_pck=false
custom_template/release=""
custom_template/debug=""
[preset.2]
name="HTML5"
platform="HTML5"
runnable=true
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="export/html/GameOfLife.html"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.2.options]
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=false
html/custom_html_shell=""
html/head_include=""
custom_template/release=""
custom_template/debug=""
[preset.3]
name="Linux/X11 32"
platform="Linux/X11"
runnable=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="export/Linux/32/GameOfLife.x86"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.3.options]
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
binary_format/64_bits=false
binary_format/embed_pck=false
custom_template/release=""
custom_template/debug=""
[preset.4]
name="Windows Desktop 32"
platform="Windows Desktop"
runnable=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="export/win32/win32/GameOfLife.exe"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
[preset.4.options]
texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
binary_format/64_bits=false
binary_format/embed_pck=false
custom_template/release=""
custom_template/debug=""
codesign/enable=false
codesign/identity_type=0
codesign/identity=""
codesign/password=""
codesign/timestamp=true
codesign/timestamp_server_url=""
codesign/digest_algorithm=1
codesign/description=""
codesign/custom_options=PoolStringArray( )
application/icon="res://icon/icon.ico"
application/file_version=""
application/product_version=""
application/company_name=""
application/product_name=""
application/file_description=""
application/copyright=""
application/trademarks=""

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

34
icon.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
icon/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

BIN
icon/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

34
icon/icon.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-ffd744aa4cf81fe1c91e4d1cd246c5a2.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon/icon.png"
dest_files=[ "res://.import/icon.png-ffd744aa4cf81fe1c91e4d1cd246c5a2.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

65
project.godot Normal file
View File

@ -0,0 +1,65 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="GameOfLife"
run/main_scene="res://Escenas/Game/game.tscn"
boot_splash/image="res://Textures/black.png"
boot_splash/bg_color=Color( 0, 0, 0, 1 )
config/icon="res://icon/icon.png"
config/windows_native_icon="res://icon/icon.ico"
[autoload]
Glovar="*res://Scripts/Glovar.gd"
[display]
window/size/height=512
window/size/fullscreen=true
window/stretch/mode="2d"
window/stretch/aspect="keep"
[input]
end={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"unicode":0,"echo":false,"script":null)
]
}
clickder={
"deadzone": 0.5,
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":2,"pressed":false,"doubleclick":false,"script":null)
]
}
clickizq={
"deadzone": 0.5,
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)
]
}
esc={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"unicode":0,"echo":false,"script":null)
]
}
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_environment="res://default_env.tres"