Ver Fonte

Update isometric demo

Aaron Franke há 5 anos atrás
pai
commit
b0b63e80f5

+ 4 - 4
2d/isometric/dungeon.tscn

@@ -3,9 +3,9 @@
 [ext_resource path="res://tileset.tres" type="TileSet" id=1]
 [ext_resource path="res://troll.tscn" type="PackedScene" id=2]
 
-[node name="dungeon" type="Node2D"]
+[node name="Dungeon" type="Node2D"]
 
-[node name="floor" type="TileMap" parent="."]
+[node name="Floor" type="TileMap" parent="."]
 mode = 1
 tile_set = ExtResource( 1 )
 cell_size = Vector2( 128, 64 )
@@ -13,7 +13,7 @@ cell_tile_origin = 1
 format = 1
 tile_data = PoolIntArray( -851956, 0, -1200553578, -851955, 0, -1200553578, -851954, 0, -1200553578, -786420, 1, -1200553578, -786419, 0, -1200553578, -786418, 0, -1200553578, -720884, 0, -1200553578, -720883, 0, -1200553578, -720882, 0, -1200553578, -655348, 1, -1200553578, -655347, 0, -1200553578, -655346, 0, -1200553578, -589812, 1, -1200553578, -589811, 0, -1200553578, -589810, 0, -1200553578, -524276, 0, -1200553578, -524275, 1, -1200553578, -524274, 0, -1200553578, -458740, 0, -1200553578, -458739, 0, -1200553578, -458738, 0, -1200553578, -393210, 0, -1200553578, -393209, 0, -1200553578, -393208, 0, -1200553578, -393207, 0, -1200553578, -393206, 0, -1200553578, -393205, 0, -1200553578, -393204, 0, -1200553578, -393203, 0, -1200553578, -393202, 0, -1200553578, -327674, 0, -1200553578, -327673, 0, -1200553578, -327672, 1, -1200553578, -327671, 1, -1200553578, -327670, 1, -1200553578, -327669, 1, -1200553578, -327668, 1, -1200553578, -327667, 0, -1200553578, -327666, 0, -1200553578, -262138, 0, -1200553578, -262137, 0, -1200553578, -262136, 0, -1200553578, -262135, 0, -1200553578, -262134, 0, -1200553578, -262133, 0, -1200553578, -262132, 0, -1200553578, -262131, 0, -1200553578, -262130, 0, -1200553578, -196602, 0, -1200553578, -196601, 0, -1200553578, -196600, 0, -1200553578, -196599, 0, -1200553578, -196598, 0, -1200553578, -196597, 0, -1200553578, -196596, 0, -1200553578, -196595, 0, -1200553578, -196594, 0, -1200553578, -131066, 0, -1200553578, -131065, 0, -1200553578, -131064, 0, -1200553578, -131063, 0, -1200553578, -65530, 0, -1200553578, -65529, 0, -1200553578, -65528, 0, -1200553578, -65527, 0, -1200553578, 6, 0, -1200553578, 7, 1, -1200553578, 8, 0, -1200553578, 9, 0, -1200553578, 65542, 0, -1200553578, 65543, 0, -1200553578, 65544, 0, -1200553578, 65545, 0, -1200553578, 131078, 0, -1200553578, 131079, 0, -1200553578, 131080, 0, -1200553578, 131081, 0, -1200553578, 196614, 0, -1200553578, 196615, 0, -1200553578, 196616, 0, -1200553578 )
 
-[node name="walls" type="TileMap" parent="."]
+[node name="Walls" type="TileMap" parent="."]
 mode = 1
 tile_set = ExtResource( 1 )
 cell_size = Vector2( 128, 64 )
@@ -22,5 +22,5 @@ cell_y_sort = true
 format = 1
 tile_data = PoolIntArray( -917493, 2, -1200553578, -917492, 2, -1200553578, -917491, 2, -1200553578, -917490, 2, -1200553578, -917489, 2, -1200553578, -851957, 2, -1200553578, -851956, 3, -1200553578, -851954, 3, -1200553578, -851953, 2, -1200553578, -786421, 2, -1200553578, -786420, 3, -1200553578, -786418, 3, -1200553578, -786417, 2, -1200553578, -720885, 2, -1200553578, -720881, 2, -1200553578, -655349, 2, -1200553578, -655348, 2, -1200553578, -655346, 3, -1200553578, -655345, 2, -1200553578, -589813, 2, -1200553578, -589809, 2, -1200553578, -524277, 2, -1200553578, -524273, 2, -1200553578, -458747, 2, -1200553578, -458746, 2, -1200553578, -458745, 2, -1200553578, -458744, 536870916, -1200553578, -458743, 536870916, -1200553578, -458742, 2, -1200553578, -458741, 2, -1200553578, -458740, 2, -1200553578, -458738, 2, -1200553578, -458737, 2, -1200553578, -393211, 2, -1200553578, -393209, 3, -1200553578, -393205, 3, -1200553578, -393201, 2, -1200553578, -327675, 4, -1200553578, -327665, 2, -1200553578, -262139, 4, -1200553578, -262129, 2, -1200553578, -196603, 2, 0, -196601, 3, 0, -196593, 2, -1200553578, -131067, 2, 0, -131062, 2, -1200553578, -131061, 2, -1200553578, -131060, 2, -1200553578, -131059, 2, -1200553578, -131058, 2, -1200553578, -131057, 2, -1200553578, -65531, 2, 0, -65530, 2, 0, -65527, 2, -1200553578, -65526, 2, -1200553578, 5, 2, -1200553578, 10, 2, 0, 65541, 2, -1200553578, 65546, 2, 0, 131077, 2, -1200553578, 131081, 3, 0, 131082, 2, 0, 196613, 2, -1200553578, 196618, 2, 0, 262149, 2, -1200553578, 262150, 2, -1200553578, 262151, 2, -1200553578, 262152, 2, -1200553578, 262153, 2, -1200553578, 262154, 2, -1200553578 )
 
-[node name="troll" parent="walls" instance=ExtResource( 2 )]
+[node name="Troll" parent="Walls" instance=ExtResource( 2 )]
 position = Vector2( 368.142, 347.007 )

+ 13 - 1
2d/isometric/project.godot

@@ -35,24 +35,36 @@ gen_mipmaps=false
 
 [input]
 
-move_bottom={
+move_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)
+, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
+, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
  ]
 }
 move_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)
+, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
+, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
  ]
 }
 move_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)
+, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
+, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
  ]
 }
 move_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)
+, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
+, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
  ]
 }
 

+ 18 - 18
2d/isometric/tileset.tres

@@ -3,80 +3,80 @@
 [ext_resource path="res://isotiles.png" type="Texture" id=1]
 
 [sub_resource type="ConvexPolygonShape2D" id=1]
-
-custom_solver_bias = 0.0
 points = PoolVector2Array( -4, -30, 60, 2, -4, 34, -68, 2 )
 
 [sub_resource type="ConvexPolygonShape2D" id=2]
-
-custom_solver_bias = 0.0
 points = PoolVector2Array( -4, -22, 12, -22, 28, -6, 4, 10, -4, 10, -20, -6 )
 
 [sub_resource type="ConvexPolygonShape2D" id=3]
-
-custom_solver_bias = 0.0
 points = PoolVector2Array( -21.905, 23.3748, 50.095, -8.62516, 66.095, -0.62516, -5.90501, 31.3748 )
 
 [resource]
-
-0/name = "base"
+0/name = "Base"
 0/texture = ExtResource( 1 )
 0/tex_offset = Vector2( -66, -42 )
 0/modulate = Color( 1, 1, 1, 1 )
 0/region = Rect2( 28, 92, 132, 84 )
-0/is_autotile = false
+0/tile_mode = 0
 0/occluder_offset = Vector2( 0, 0 )
 0/navigation_offset = Vector2( 0, 0 )
 0/shapes = [  ]
-1/name = "base2"
+0/z_index = 0
+1/name = "Base2"
 1/texture = ExtResource( 1 )
 1/tex_offset = Vector2( -66, -42 )
 1/modulate = Color( 1, 1, 1, 1 )
 1/region = Rect2( 220, 92, 132, 84 )
-1/is_autotile = false
+1/tile_mode = 0
 1/occluder_offset = Vector2( 0, 0 )
 1/navigation_offset = Vector2( 0, 0 )
 1/shapes = [  ]
-2/name = "wall"
+1/z_index = 0
+2/name = "Wall"
 2/texture = ExtResource( 1 )
 2/tex_offset = Vector2( -69.3109, -99.8051 )
 2/modulate = Color( 1, 1, 1, 1 )
 2/region = Rect2( 28, 220, 132, 136 )
-2/is_autotile = false
+2/tile_mode = 0
 2/occluder_offset = Vector2( 0, 0 )
 2/navigation_offset = Vector2( 0, 0 )
 2/shapes = [ {
 "autotile_coord": Vector2( 0, 0 ),
 "one_way": false,
+"one_way_margin": 1.0,
 "shape": SubResource( 1 ),
 "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
 } ]
-3/name = "column"
+2/z_index = 0
+3/name = "Column"
 3/texture = ExtResource( 1 )
 3/tex_offset = Vector2( -69.5632, -100.446 )
 3/modulate = Color( 1, 1, 1, 1 )
 3/region = Rect2( 220, 220, 132, 136 )
-3/is_autotile = false
+3/tile_mode = 0
 3/occluder_offset = Vector2( 0, 0 )
 3/navigation_offset = Vector2( 0, 0 )
 3/shapes = [ {
 "autotile_coord": Vector2( 0, 0 ),
 "one_way": false,
+"one_way_margin": 1.0,
 "shape": SubResource( 2 ),
 "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
 } ]
-4/name = "door1"
+3/z_index = 0
+4/name = "Door1"
 4/texture = ExtResource( 1 )
 4/tex_offset = Vector2( -50.3623, -90.8164 )
 4/modulate = Color( 1, 1, 1, 1 )
 4/region = Rect2( 24, 408, 132, 136 )
-4/is_autotile = false
+4/tile_mode = 0
 4/occluder_offset = Vector2( 0, 0 )
 4/navigation_offset = Vector2( 0, 0 )
 4/shapes = [ {
 "autotile_coord": Vector2( 0, 0 ),
 "one_way": false,
+"one_way_margin": 1.0,
 "shape": SubResource( 3 ),
 "shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
 } ]
-
+4/z_index = 0

+ 12 - 13
2d/isometric/tileset_edit.tscn

@@ -2,9 +2,9 @@
 
 [ext_resource path="res://isotiles.png" type="Texture" id=1]
 
-[node name="Node2D" type="Node2D"]
+[node name="TilesetEdit" type="Node2D"]
 
-[node name="base" type="Sprite" parent="."]
+[node name="Base" type="Sprite" parent="."]
 position = Vector2( 150.049, 61.1264 )
 texture = ExtResource( 1 )
 centered = false
@@ -12,7 +12,7 @@ offset = Vector2( -66, -42 )
 region_enabled = true
 region_rect = Rect2( 28, 92, 132, 84 )
 
-[node name="base2" type="Sprite" parent="."]
+[node name="Base2" type="Sprite" parent="."]
 position = Vector2( 257.013, 124.86 )
 texture = ExtResource( 1 )
 centered = false
@@ -20,7 +20,7 @@ offset = Vector2( -66, -42 )
 region_enabled = true
 region_rect = Rect2( 220, 92, 132, 84 )
 
-[node name="wall" type="Sprite" parent="."]
+[node name="Wall" type="Sprite" parent="."]
 position = Vector2( 421.311, 137.805 )
 texture = ExtResource( 1 )
 centered = false
@@ -28,12 +28,12 @@ offset = Vector2( -69.3109, -99.8051 )
 region_enabled = true
 region_rect = Rect2( 28, 220, 132, 136 )
 
-[node name="StaticBody2D" type="StaticBody2D" parent="wall"]
+[node name="StaticBody2D" type="StaticBody2D" parent="Wall"]
 
-[node name="collision" type="CollisionPolygon2D" parent="wall/StaticBody2D"]
+[node name="collision" type="CollisionPolygon2D" parent="Wall/StaticBody2D"]
 polygon = PoolVector2Array( -68, 2, -4, 34, 60, 2, -4, -30 )
 
-[node name="column" type="Sprite" parent="."]
+[node name="Column" type="Sprite" parent="."]
 position = Vector2( 359.563, 266.446 )
 texture = ExtResource( 1 )
 centered = false
@@ -41,12 +41,12 @@ offset = Vector2( -69.5632, -100.446 )
 region_enabled = true
 region_rect = Rect2( 220, 220, 132, 136 )
 
-[node name="StaticBody" type="StaticBody2D" parent="column"]
+[node name="StaticBody" type="StaticBody2D" parent="Column"]
 
-[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="column/StaticBody"]
+[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Column/StaticBody"]
 polygon = PoolVector2Array( -20, -6, -4, 10, 4, 10, 28, -6, 12, -22, -4, -22 )
 
-[node name="door1" type="Sprite" parent="."]
+[node name="Door1" type="Sprite" parent="."]
 position = Vector2( -24.1548, 142.216 )
 texture = ExtResource( 1 )
 centered = false
@@ -54,8 +54,7 @@ offset = Vector2( -50.3623, -90.8164 )
 region_enabled = true
 region_rect = Rect2( 24, 408, 132, 136 )
 
-[node name="StaticBody2D" type="StaticBody2D" parent="door1"]
+[node name="StaticBody2D" type="StaticBody2D" parent="Door1"]
 
-[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="door1/StaticBody2D"]
+[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Door1/StaticBody2D"]
 polygon = PoolVector2Array( -5.90501, 31.3748, 66.095, -0.62516, 50.095, -8.62516, -21.905, 23.3748 )
-

+ 4 - 16
2d/isometric/troll.gd

@@ -1,24 +1,12 @@
 extends KinematicBody2D
 
-# This is a demo showing how KinematicBody2D
-# move_and_slide works.
-
-# Member variables
 const MOTION_SPEED = 160 # Pixels/second
 
-
 func _physics_process(_delta):
 	var motion = Vector2()
-	
-	if Input.is_action_pressed("move_up"):
-		motion += Vector2(0, -1)
-	if Input.is_action_pressed("move_bottom"):
-		motion += Vector2(0, 1)
-	if Input.is_action_pressed("move_left"):
-		motion += Vector2(-1, 0)
-	if Input.is_action_pressed("move_right"):
-		motion += Vector2(1, 0)
-	
+	motion.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
+	motion.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
+	motion.y *= 0.5
 	motion = motion.normalized() * MOTION_SPEED
-
+	#warning-ignore:return_value_discarded
 	move_and_slide(motion)

+ 1 - 2
2d/isometric/troll.tscn

@@ -6,7 +6,7 @@
 [sub_resource type="CircleShape2D" id=1]
 radius = 16.0
 
-[node name="troll" type="KinematicBody2D"]
+[node name="Troll" type="KinematicBody2D"]
 script = ExtResource( 1 )
 
 [node name="Sprite" type="Sprite" parent="."]
@@ -19,4 +19,3 @@ shape = SubResource( 1 )
 
 [node name="Camera2D" type="Camera2D" parent="."]
 current = true
-