-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9e805e2
Showing
8 changed files
with
315 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.import | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
extends KinematicBody2D | ||
|
||
|
||
# Max speeds | ||
const FWD_SPEED = 40 | ||
const TURN_SPEED = 90 # degrees per second | ||
|
||
|
||
# Global Vars | ||
var velocity = Vector2.ZERO | ||
var heading | ||
|
||
func _ready(): | ||
heading = get_rotation_degrees() | ||
print("heading: ", heading) | ||
|
||
func _physics_process(delta): | ||
var turn = TURN_SPEED * (Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")) | ||
|
||
heading = heading + (turn * delta) | ||
|
||
if turn != 0: | ||
set_rotation_degrees(heading) | ||
print("heading: ", heading) | ||
|
||
var fwd = FWD_SPEED * delta * (Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")) | ||
|
||
if fwd !=0: | ||
var adj_heading = heading+90 | ||
velocity.x = fwd * cos(adj_heading * (PI/180)) | ||
velocity.y = fwd * sin(adj_heading * (PI/180)) | ||
print("velocity: ", velocity) | ||
else: | ||
velocity = Vector2.ZERO | ||
|
||
move_and_collide(velocity) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,236 @@ | ||
[gd_scene load_steps=26 format=2] | ||
|
||
[ext_resource path="res://dg_tank.png" type="Texture" id=1] | ||
[ext_resource path="res://border_tiles.png" type="Texture" id=2] | ||
[ext_resource path="res://GreenTank.gd" type="Script" id=3] | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=1] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=2] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=3] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=4] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=5] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=6] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=7] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=8] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=9] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=10] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=11] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=12] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=13] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=14] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=15] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=16] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=17] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=18] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=19] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="ConvexPolygonShape2D" id=20] | ||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) | ||
|
||
[sub_resource type="TileSet" id=21] | ||
0/name = "border_tiles.png 0" | ||
0/texture = ExtResource( 2 ) | ||
0/tex_offset = Vector2( 0, 0 ) | ||
0/modulate = Color( 1, 1, 1, 1 ) | ||
0/region = Rect2( 0, 0, 80, 64 ) | ||
0/tile_mode = 1 | ||
0/autotile/bitmask_mode = 1 | ||
0/autotile/bitmask_flags = [ Vector2( 0, 0 ), 16, Vector2( 0, 1 ), 152, Vector2( 0, 2 ), 54, Vector2( 0, 3 ), 504, Vector2( 1, 0 ), 144, Vector2( 1, 1 ), 216, Vector2( 1, 2 ), 176, Vector2( 1, 3 ), 219, Vector2( 2, 0 ), 24, Vector2( 2, 1 ), 26, Vector2( 2, 2 ), 432, Vector2( 2, 3 ), 63, Vector2( 3, 0 ), 18, Vector2( 3, 1 ), 27, Vector2( 3, 2 ), 146, Vector2( 3, 3 ), 438, Vector2( 4, 0 ), 48, Vector2( 4, 1 ), 50, Vector2( 4, 2 ), 56, Vector2( 4, 3 ), 511 ] | ||
0/autotile/icon_coordinate = Vector2( 0, 0 ) | ||
0/autotile/tile_size = Vector2( 16, 16 ) | ||
0/autotile/spacing = 0 | ||
0/autotile/occluder_map = [ ] | ||
0/autotile/navpoly_map = [ ] | ||
0/autotile/priority_map = [ ] | ||
0/autotile/z_index_map = [ ] | ||
0/occluder_offset = Vector2( 0, 0 ) | ||
0/navigation_offset = Vector2( 0, 0 ) | ||
0/shape_offset = Vector2( 0, 0 ) | ||
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
0/shape = SubResource( 1 ) | ||
0/shape_one_way = false | ||
0/shape_one_way_margin = 1.0 | ||
0/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 ) | ||
}, { | ||
"autotile_coord": Vector2( 1, 0 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 2 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 2, 0 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 3 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 3, 0 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 4 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 4, 0 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 5 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 0, 1 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 6 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 1, 1 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 7 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 2, 1 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 8 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 3, 1 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 9 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 4, 1 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 10 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 0, 2 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 11 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 1, 2 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 12 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 2, 2 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 13 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 3, 2 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 14 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 4, 2 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 15 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 0, 3 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 16 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 1, 3 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 17 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 2, 3 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 18 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 3, 3 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 19 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
}, { | ||
"autotile_coord": Vector2( 4, 3 ), | ||
"one_way": false, | ||
"one_way_margin": 1.0, | ||
"shape": SubResource( 20 ), | ||
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
} ] | ||
0/z_index = 0 | ||
|
||
[sub_resource type="RectangleShape2D" id=22] | ||
extents = Vector2( 7.05204, 7.29448 ) | ||
|
||
[node name="World" type="Node2D"] | ||
|
||
[node name="TileMap" type="TileMap" parent="."] | ||
tile_set = SubResource( 21 ) | ||
cell_size = Vector2( 16, 16 ) | ||
format = 1 | ||
tile_data = PoolIntArray( -1, 0, 131073, -65536, 0, 131076, -65535, 0, 131076, -65534, 0, 131076, -65533, 0, 131076, -65532, 0, 131076, -65531, 0, 131076, -65530, 0, 131076, -65529, 0, 131076, -65528, 0, 131076, -65527, 0, 131076, -65526, 0, 131076, -65525, 0, 131076, -65524, 0, 131076, -65523, 0, 131076, -65522, 0, 131076, -65521, 0, 131076, -65520, 0, 131076, -65519, 0, 131076, -65518, 0, 131076, -65517, 0, 131076, -65516, 0, 65536, 65535, 0, 131075, 20, 0, 131075, 131071, 0, 131075, 65545, 0, 4, 65546, 0, 2, 65556, 0, 131075, 196607, 0, 131075, 131092, 0, 131075, 262143, 0, 131075, 196628, 0, 131075, 327679, 0, 131075, 262146, 0, 4, 262147, 0, 65536, 262160, 0, 131073, 262161, 0, 2, 262164, 0, 131075, 393215, 0, 131075, 327683, 0, 131075, 327686, 0, 1, 327689, 0, 131074, 327690, 0, 65537, 327693, 0, 1, 327696, 0, 131075, 327700, 0, 131075, 458751, 0, 131075, 393219, 0, 131075, 393222, 0, 3, 393225, 0, 131072, 393226, 0, 65539, 393229, 0, 3, 393232, 0, 131075, 393236, 0, 131075, 524287, 0, 131075, 458754, 0, 4, 458755, 0, 65538, 458768, 0, 65540, 458769, 0, 2, 458772, 0, 131075, 589823, 0, 131075, 524308, 0, 131075, 655359, 0, 131075, 589844, 0, 131075, 720895, 0, 131075, 655369, 0, 4, 655370, 0, 2, 655380, 0, 131075, 786431, 0, 131075, 720916, 0, 131075, 851967, 0, 65540, 786432, 0, 131076, 786433, 0, 131076, 786434, 0, 131076, 786435, 0, 131076, 786436, 0, 131076, 786437, 0, 131076, 786438, 0, 131076, 786439, 0, 131076, 786440, 0, 131076, 786441, 0, 131076, 786442, 0, 131076, 786443, 0, 131076, 786444, 0, 131076, 786445, 0, 131076, 786446, 0, 131076, 786447, 0, 131076, 786448, 0, 131076, 786449, 0, 131076, 786450, 0, 131076, 786451, 0, 131076, 786452, 0, 65538 ) | ||
|
||
[node name="GreenTank" type="KinematicBody2D" parent="."] | ||
position = Vector2( 301.078, 94.6326 ) | ||
rotation = 4.71239 | ||
script = ExtResource( 3 ) | ||
__meta__ = { | ||
"_edit_group_": true | ||
} | ||
|
||
[node name="Sprite" type="Sprite" parent="GreenTank"] | ||
texture = ExtResource( 1 ) | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="GreenTank"] | ||
shape = SubResource( 22 ) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
; 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="tank2" | ||
run/main_scene="res://World.tscn" | ||
config/icon="res://icon.png" | ||
|
||
[display] | ||
|
||
window/size/width=320 | ||
window/size/height=192 | ||
window/size/test_width=1280 | ||
window/size/test_height=768 | ||
window/stretch/mode="2d" | ||
|
||
[rendering] | ||
|
||
environment/default_environment="res://default_env.tres" |