Skip to content

Commit

Permalink
Add files for tutorial 10
Browse files Browse the repository at this point in the history
  • Loading branch information
ndee85 committed Feb 14, 2015
1 parent 3558b49 commit b31ad59
Show file tree
Hide file tree
Showing 12 changed files with 99 additions and 21 deletions.
16 changes: 8 additions & 8 deletions project/.fscache
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
::res://::1422993807
character.xml::PackedScene::1422710762::
::res://::1423918886
character.xml::PackedScene::1422995685::
character_sprites.xml::PackedScene::1422993807::
icon.png::ImageTexture::1422710762::
level_01.xml::PackedScene::1422993807::
level_01.xml::PackedScene::1422996265::
level_ground_element_01.xml::PackedScene::1422710762::
::res://scripts::1422710762
input_states.gd::GDScript::1422710762::
player.gd::GDScript::1422710762::
::res://textures::1422710762
::res://scripts::1423918965
input_states.gd::GDScript::1422996268::
player.gd::GDScript::1422996268::
::res://textures::1423918886
blue_square.png::ImageTexture::1422710762::
red_square.png::ImageTexture::1422710762::
::res://textures/gbot::1422710762
::res://textures/gbot::1423918886
gBot_arm_l.png::ImageTexture::1422710762::
gBot_arm_r.png::ImageTexture::1422710762::
gBot_body.png::ImageTexture::1422710762::
Expand Down
4 changes: 4 additions & 0 deletions project/engine.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ name="Godot Tutorial"
main_scene="res://level_01.xml"
icon="icon.png"

[autoload]

global="res://scripts/global.gd"

[display]

width=800
Expand Down
71 changes: 58 additions & 13 deletions project/level_01.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<resource_file type="PackedScene" subresource_count="3" version="1.0" version_name="Godot Engine v1.0.stable.custom_build">
<resource_file type="PackedScene" subresource_count="10" version="1.0" version_name="Godot Engine v1.0.stable.custom_build">
<ext_resource path="res://textures/buttons/touch_left.png" type="Texture"></ext_resource>
<ext_resource path="res://textures/buttons/touch_right.png" type="Texture"></ext_resource>
<ext_resource path="res://textures/buttons/touch_left_pressed.png" type="Texture"></ext_resource>
<ext_resource path="res://textures/buttons/touch_right_pressed.png" type="Texture"></ext_resource>
<ext_resource path="res://scripts/touch_screen_button.gd" type="Script"></ext_resource>
<ext_resource path="res://textures/buttons/touch_jump.png" type="Texture"></ext_resource>
<ext_resource path="res://textures/buttons/touch_jump_pressed.png" type="Texture"></ext_resource>
<ext_resource path="res://character.xml" type="PackedScene"></ext_resource>
<ext_resource path="res://level_ground_element_01.xml" type="PackedScene"></ext_resource>
<main_resource>
<dictionary name="_bundled" shared="false">
<string> "names" </string>
<string_array len="21">
<string_array len="39">
<string> "world" </string>
<string> "Node2D" </string>
<string> "_import_path" </string>
Expand All @@ -27,15 +34,33 @@
<string> "StaticBody2D" </string>
<string> "ground1" </string>
<string> "ground2" </string>
<string> "gui" </string>
<string> "CanvasLayer" </string>
<string> "layer" </string>
<string> "offset" </string>
<string> "rotation" </string>
<string> "scale" </string>
<string> "script/script" </string>
<string> "left_inputs" </string>
<string> "left" </string>
<string> "TouchScreenButton" </string>
<string> "normal" </string>
<string> "pressed" </string>
<string> "bitmask" </string>
<string> "passby_press" </string>
<string> "action" </string>
<string> "visibility_mode" </string>
<string> "right" </string>
<string> "right_inputs" </string>
</string_array>
<string> "version" </string>
<int> 1 </int>
<string> "conn_count" </string>
<int> 0 </int>
<string> "node_count" </string>
<int> 5 </int>
<int> 11 </int>
<string> "variants" </string>
<array len="20" shared="false">
<array len="37" shared="false">
<node_path> "" </node_path>
<bool> True </bool>
<real> 1 </real>
Expand All @@ -49,11 +74,13 @@
<string> "Script" </string>
<dictionary shared="false">
<string> "current" </string>
<int> 0 </int>
<int> 3 </int>
<string> "sources" </string>
<array len="2" shared="false">
<array len="4" shared="false">
<string> "res://scripts/player.gd" </string>
<string> "res://scripts/input_states.gd" </string>
<string> "res://scripts/global.gd" </string>
<string> "res://scripts/touch_screen_button.gd" </string>
</array>
</dictionary>
<string> "2D" </string>
Expand All @@ -65,7 +92,7 @@
<string> "use_snap" </string>
<bool> False </bool>
<string> "ofs" </string>
<vector2> -384.374, -442.628 </vector2>
<vector2> -632, -611.99 </vector2>
<string> "snap" </string>
<int> 10 </int>
</dictionary>
Expand Down Expand Up @@ -177,22 +204,40 @@
<dictionary shared="false">
<string> "_editor_collapsed" </string>
<bool> True </bool>
<string> "__editor_show_subtree" </string>
<bool> True </bool>
</dictionary>
<int> 1200 </int>
<int> 1000 </int>
<int> 2000 </int>
<int> 1400 </int>
<int> 2800 </int>
<resource resource_type="PackedScene" path="res://level_ground_element_01.xml"> </resource>
<dictionary shared="false">
<string> "_editor_collapsed" </string>
<bool> True </bool>
</dictionary>
<vector2> 1007.29, 245.13 </vector2>
<real> 40.901497 </real>
<vector2> 1685.38, -7.06762 </vector2>
<vector2> 1157.61, 353.692 </vector2>
<real> 19.574837 </real>
<vector2> 1919.21, 220.077 </vector2>
<real> 0.222343 </real>
<int> 1 </int>
<resource resource_type="Script" path="res://scripts/touch_screen_button.gd"> </resource>
<vector2> 0.4, 0.4 </vector2>
<vector2> 3.34033, -779.975 </vector2>
<resource resource_type="Texture" path="res://textures/buttons/touch_left.png"> </resource>
<resource resource_type="Texture" path="res://textures/buttons/touch_left_pressed.png"> </resource>
<resource name=""></resource> <bool> False </bool>
<string> "btn_left" </string>
<vector2> 310.654, -414.205 </vector2>
<resource resource_type="Texture" path="res://textures/buttons/touch_right.png"> </resource>
<resource resource_type="Texture" path="res://textures/buttons/touch_right_pressed.png"> </resource>
<string> "btn_right" </string>
<vector2> -469.321, -452.619 </vector2>
<resource resource_type="Texture" path="res://textures/buttons/touch_jump.png"> </resource>
<resource resource_type="Texture" path="res://textures/buttons/touch_jump_pressed.png"> </resource>
<string> "btn_jump" </string>
</array>
<string> "nodes" </string>
<int_array len="87"> -1, -1, 1, 0, -1, 10, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 10, 1, 11, 7, 0, 0, 0, 13, 12, 8, 6, 2, 0, 6, 9, 11, 10, 14, 11, 15, 12, 16, 13, 0, 0, 0, 18, 17, 14, 2, 2, 0, 11, 15, 0, 0, 0, 18, 19, 14, 4, 2, 0, 6, 16, 7, 17, 11, 15, 0, 0, 0, 18, 20, 14, 4, 2, 0, 6, 18, 7, 19, 11, 15, 0 </int_array>
<int_array len="267"> -1, -1, 1, 0, -1, 10, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 4, 8, 5, 9, 6, 10, 1, 11, 7, 0, 0, 0, 13, 12, 8, 6, 2, 0, 6, 9, 11, 10, 14, 11, 15, 12, 16, 13, 0, 0, 0, 18, 17, 14, 2, 2, 0, 11, 15, 0, 0, 0, 18, 19, 14, 4, 2, 0, 6, 16, 7, 17, 11, 15, 0, 0, 0, 18, 20, 14, 4, 2, 0, 6, 18, 7, 19, 11, 15, 0, 0, 0, 22, 21, -1, 6, 2, 0, 23, 20, 24, 3, 25, 4, 26, 5, 27, 21, 0, 5, 0, 1, 28, -1, 9, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 4, 8, 22, 9, 6, 10, 1, 0, 6, 0, 30, 29, -1, 15, 2, 0, 3, 1, 4, 2, 5, 2, 6, 23, 7, 4, 8, 5, 9, 6, 10, 1, 31, 24, 32, 25, 33, 26, 34, 27, 35, 28, 36, 6, 0, 6, 0, 30, 37, -1, 15, 2, 0, 3, 1, 4, 2, 5, 2, 6, 29, 7, 4, 8, 5, 9, 6, 10, 1, 31, 30, 32, 31, 33, 26, 34, 27, 35, 32, 36, 6, 0, 5, 0, 1, 38, -1, 9, 2, 0, 3, 1, 4, 2, 5, 2, 6, 3, 7, 4, 8, 22, 9, 6, 10, 1, 0, 9, 0, 30, 30, -1, 15, 2, 0, 3, 1, 4, 2, 5, 2, 6, 33, 7, 4, 8, 5, 9, 6, 10, 1, 31, 34, 32, 35, 33, 26, 34, 27, 35, 36, 36, 6, 0 </int_array>
<string> "conns" </string>
<int_array len="0"> </int_array>
</dictionary>
Expand Down
10 changes: 10 additions & 0 deletions project/scripts/global.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends Node

var viewport_scale
var viewport_res

func _ready():
var viewport = get_node("/root").get_children()[1].get_viewport_rect().size
viewport_res = get_node("/root").get_children()[1].get_viewport_rect().size
viewport_scale = 600/viewport.y

2 changes: 2 additions & 0 deletions project/scripts/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ func is_on_ground():
return false

func _ready():
get_node("Camera2D").set_zoom(get_node("Camera2D").get_zoom() * get_node("/root/global").viewport_scale)

raycast_down = get_node("RayCast2D")
raycast_down.add_exception(self)
rotate = get_node("rotate")
Expand Down
17 changes: 17 additions & 0 deletions project/scripts/touch_screen_button.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

extends CanvasLayer

# member variables here, example:
# var a=2
# var b="textvar"

func _ready():
# Initialization here
print("test")
get_node("left_inputs").set_pos(Vector2(0,get_node("/root/global").viewport_res.y))
get_node("left_inputs").set_scale(get_node("left_inputs").get_scale() / get_node("/root/global").viewport_scale)

get_node("right_inputs").set_pos(get_node("/root/global").viewport_res)
get_node("right_inputs").set_scale(get_node("right_inputs").get_scale() / get_node("/root/global").viewport_scale)


Binary file added project/textures/buttons/touch_jump.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project/textures/buttons/touch_jump_pressed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project/textures/buttons/touch_left.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project/textures/buttons/touch_left_pressed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project/textures/buttons/touch_right.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added project/textures/buttons/touch_right_pressed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b31ad59

Please sign in to comment.