commit 2ceb1eeb893fed942a403f97bd6f392c1f9797b9 Author: Sebastian Morr Date: Wed Jan 29 20:25:13 2020 +0100 Basic project with export Makefile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3a96203 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.import/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5aaf222 --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +name = "untitled-game" + +all: linux macos windows web + +linux: + mkdir -p /tmp/$(name)-linux + /usr/bin/godot --export "Linux" "/tmp/$(name)-linux/$(name)" + zip -r /tmp/$(name)-linux.zip /tmp/$(name)-linux + rm -r /tmp/$(name)-linux + +macos: + /usr/bin/godot --export "Mac OS" "/tmp/$(name)-macos.app" + mv "/tmp/$(name)-macos.app" "/tmp/$(name)-macos.zip" + +windows: + mkdir -p /tmp/$(name)-windows + /usr/bin/godot --export "Windows" "/tmp/$(name)-windows/$(name).exe" + zip -r /tmp/$(name)-windows.zip /tmp/$(name)-windows + rm -r /tmp/$(name)-windows + +web: + mkdir -p /tmp/$(name)-web + /usr/bin/godot --export "HTML5" "/tmp/$(name)-web/index.html" + zip -r /tmp/$(name)-web.zip /tmp/$(name)-web + rm -r /tmp/$(name)-web diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..6d703e5 --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,111 @@ +[preset.0] + +name="Linux" +platform="Linux/X11" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="" +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 +custom_template/release="" +custom_template/debug="" + +[preset.1] + +name="Mac OS" +platform="Mac OSX" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="" +patch_list=PoolStringArray( ) +script_export_mode=1 +script_encryption_key="" + +[preset.1.options] + +custom_package/debug="" +custom_package/release="" +application/name="Untitled Game" +application/info="" +application/icon="" +application/identifier="" +application/signature="" +application/short_version="1.0" +application/version="1.0" +application/copyright="" +display/high_res=false +texture_format/s3tc=true +texture_format/etc=false +texture_format/etc2=false + +[preset.2] + +name="Windows" +platform="Windows Desktop" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="" +patch_list=PoolStringArray( ) +script_export_mode=1 +script_encryption_key="" + +[preset.2.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 +custom_template/release="" +custom_template/debug="" +application/icon="" +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" + +[preset.3] + +name="HTML5" +platform="HTML5" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="" +patch_list=PoolStringArray( ) +script_export_mode=1 +script_encryption_key="" + +[preset.3.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="" diff --git a/game.gd b/game.gd new file mode 100644 index 0000000..24e1c0e --- /dev/null +++ b/game.gd @@ -0,0 +1,32 @@ +extends Node + +var _file = "user://savegame.json" +var state = {} + +func _ready(): + load_state() + +func _initial_state(): + return {} + +func save_state() -> bool: + var savegame = File.new() + + savegame.open(_file, File.WRITE) + savegame.store_line(to_json(state)) + savegame.close() + return true + +func load_state() -> bool: + var savegame = File.new() + if not savegame.file_exists(_file): + return false + + savegame.open(_file, File.READ) + + state = _initial_state() + var new_state = parse_json(savegame.get_line()) + for key in new_state: + state[key] = new_state[key] + savegame.close() + return true \ No newline at end of file diff --git a/main.tscn b/main.tscn new file mode 100644 index 0000000..f0ecde4 --- /dev/null +++ b/main.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://player.tscn" type="PackedScene" id=1] + +[node name="Main" type="Node2D"] + +[node name="Player" parent="." instance=ExtResource( 1 )] +position = Vector2( 960, 540 ) diff --git a/player.gd b/player.gd new file mode 100644 index 0000000..c9b3753 --- /dev/null +++ b/player.gd @@ -0,0 +1,11 @@ +extends KinematicBody2D + +export var speed = 800 + +func _ready(): + pass + +func _process(delta): + var right = Input.get_action_strength("right") - Input.get_action_strength("left") + var down = Input.get_action_strength("down") - Input.get_action_strength("up") + move_and_slide(Vector2(right, down).normalized()*speed) \ No newline at end of file diff --git a/player.tscn b/player.tscn new file mode 100644 index 0000000..8e30f10 --- /dev/null +++ b/player.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://player.gd" type="Script" id=1] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 50, 50 ) + +[node name="Player" type="KinematicBody2D"] +script = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 1 ) + +[node name="Rect" type="ColorRect" parent="."] +margin_left = -50.0 +margin_top = -50.0 +margin_right = 50.0 +margin_bottom = 50.0 diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..9a7845e --- /dev/null +++ b/project.godot @@ -0,0 +1,57 @@ +; 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="Untitled Game" +run/main_scene="res://main.tscn" + +[autoload] + +game="*res://game.gd" + +[display] + +window/size/width=1920 +window/size/height=1080 +window/stretch/mode="2d" +window/stretch/aspect="keep" + +[input] + +left={ +"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":16777231,"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":65,"unicode":0,"echo":false,"script":null) + ] +} +right={ +"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":16777233,"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":68,"unicode":0,"echo":false,"script":null) + ] +} +up={ +"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":16777232,"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":87,"unicode":0,"echo":false,"script":null) + ] +} +down={ +"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":16777234,"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":83,"unicode":0,"echo":false,"script":null) + ] +}