-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Chris Bradfield
committed
Apr 4, 2018
1 parent
86f6019
commit 5936b57
Showing
6 changed files
with
474 additions
and
1 deletion.
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,12 @@ | ||
extends Node2D | ||
|
||
func _ready(): | ||
set_camera_limits() | ||
|
||
func set_camera_limits(): | ||
var map_limits = $Ground.get_used_rect() | ||
var map_cellsize = $Ground.cell_size | ||
$Player/Camera2D.limit_left = map_limits.position.x * map_cellsize.x | ||
$Player/Camera2D.limit_right = map_limits.end.x * map_cellsize.x | ||
$Player/Camera2D.limit_top = map_limits.position.y * map_cellsize.y | ||
$Player/Camera2D.limit_bottom = map_limits.end.y * map_cellsize.y |
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,34 @@ | ||
[gd_scene load_steps=4 format=2] | ||
|
||
[ext_resource path="res://maps/Map.gd" type="Script" id=1] | ||
[ext_resource path="res://terrain/terrain_tiles.tres" type="TileSet" id=2] | ||
[ext_resource path="res://tanks/Player.tscn" type="PackedScene" id=3] | ||
|
||
[node name="Map01" type="Node2D" index="0"] | ||
|
||
script = ExtResource( 1 ) | ||
|
||
[node name="Ground" type="TileMap" parent="." index="0"] | ||
|
||
mode = 0 | ||
tile_set = ExtResource( 2 ) | ||
cell_size = Vector2( 128, 128 ) | ||
cell_quadrant_size = 16 | ||
cell_custom_transform = Transform2D( 1, 0, 0, 1, 0, 0 ) | ||
cell_half_offset = 2 | ||
cell_tile_origin = 0 | ||
cell_y_sort = false | ||
cell_clip_uv = false | ||
collision_use_kinematic = false | ||
collision_friction = 1.0 | ||
collision_bounce = 0.0 | ||
collision_layer = 1 | ||
collision_mask = 1 | ||
occluder_light_mask = 1 | ||
format = 1 | ||
tile_data = PoolIntArray( -1, 0, 0, -65536, 0, 0, -65535, 0, 0, -65534, 0, 0, -65533, 1, 0, -65532, 0, 0, -65531, 0, 0, -65530, 0, 0, -65529, 0, 0, -65528, 0, 0, -65527, 0, 0, -65526, 0, 0, -65525, 1, 0, -65524, 1, 0, -65523, 0, 0, -65522, 0, 0, -65521, 0, 0, -65520, 0, 0, -65519, 0, 0, -65518, 0, 0, -65517, 7, 0, -65516, 30, 0, -65515, 30, 0, -65514, 30, 0, -65513, 21, 0, -65512, 30, 0, -65511, 30, 0, -65510, 30, 0, -65509, 30, 0, -65508, 30, 0, -65507, 30, 0, -65506, 30, 0, -65505, 30, 0, -65504, 30, 0, -65503, 30, 0, -65502, 30, 0, -65501, 30, 0, -65500, 30, 0, 65535, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 0, 3, 1, 0, 4, 0, 0, 5, 0, 0, 6, 0, 0, 7, 0, 0, 8, 0, 0, 9, 0, 0, 10, 10, 0, 11, 1, 0, 12, 1, 0, 13, 10, 0, 14, 10, 0, 15, 10, 0, 16, 10, 0, 17, 10, 0, 18, 0, 0, 19, 7, 0, 20, 30, 0, 21, 30, 0, 22, 30, 0, 23, 21, 0, 24, 30, 0, 25, 30, 0, 26, 30, 0, 27, 30, 0, 28, 30, 0, 29, 30, 0, 30, 30, 0, 31, 30, 0, 32, 30, 0, 33, 30, 0, 34, 30, 0, 35, 30, 0, 36, 30, 0, 131071, 0, 0, 65536, 0, 0, 65537, 0, 0, 65538, 0, 0, 65539, 1, 0, 65540, 0, 0, 65541, 0, 0, 65542, 0, 0, 65543, 0, 0, 65544, 0, 0, 65545, 0, 0, 65546, 10, 0, 65547, 1, 0, 65548, 1, 0, 65549, 10, 0, 65550, 10, 0, 65551, 10, 0, 65552, 10, 0, 65553, 10, 0, 65554, 0, 0, 65555, 7, 0, 65556, 30, 0, 65557, 30, 0, 65558, 30, 0, 65559, 21, 0, 65560, 30, 0, 65561, 30, 0, 65562, 30, 0, 65563, 30, 0, 65564, 30, 0, 65565, 30, 0, 65566, 30, 0, 65567, 30, 0, 65568, 30, 0, 65569, 30, 0, 65570, 30, 0, 65571, 30, 0, 65572, 30, 0, 196607, 0, 0, 131072, 0, 0, 131073, 0, 0, 131074, 0, 0, 131075, 1, 0, 131076, 0, 0, 131077, 0, 0, 131078, 0, 0, 131079, 0, 0, 131080, 0, 0, 131081, 0, 0, 131082, 10, 0, 131083, 1, 0, 131084, 1, 0, 131085, 10, 0, 131086, 10, 0, 131087, 10, 0, 131088, 10, 0, 131089, 10, 0, 131090, 0, 0, 131091, 7, 0, 131092, 30, 0, 131093, 30, 0, 131094, 30, 0, 131095, 21, 0, 131096, 30, 0, 131097, 30, 0, 131098, 30, 0, 131099, 30, 0, 131100, 30, 0, 131101, 30, 0, 131102, 30, 0, 131103, 30, 0, 131104, 30, 0, 131105, 30, 0, 131106, 30, 0, 131107, 30, 0, 131108, 30, 0, 262143, 0, 0, 196608, 0, 0, 196609, 0, 0, 196610, 0, 0, 196611, 1, 0, 196612, 0, 0, 196613, 0, 0, 196614, 0, 0, 196615, 0, 0, 196616, 0, 0, 196617, 0, 0, 196618, 10, 0, 196619, 1, 0, 196620, 1, 0, 196621, 10, 0, 196622, 10, 0, 196623, 10, 0, 196624, 10, 0, 196625, 10, 0, 196626, 0, 0, 196627, 7, 0, 196628, 30, 0, 196629, 30, 0, 196630, 30, 0, 196631, 21, 0, 196632, 30, 0, 196633, 30, 0, 196634, 30, 0, 196635, 30, 0, 196636, 30, 0, 196637, 30, 0, 196638, 30, 0, 196639, 30, 0, 196640, 30, 0, 196641, 30, 0, 196642, 30, 0, 196643, 30, 0, 196644, 30, 0, 327679, 0, 0, 262144, 0, 0, 262145, 0, 0, 262146, 0, 0, 262147, 1, 0, 262148, 0, 0, 262149, 0, 0, 262150, 0, 0, 262151, 0, 0, 262152, 0, 0, 262153, 0, 0, 262154, 10, 0, 262155, 1, 0, 262156, 1, 0, 262157, 10, 0, 262158, 10, 0, 262159, 10, 0, 262160, 10, 0, 262161, 10, 0, 262162, 0, 0, 262163, 7, 0, 262164, 30, 0, 262165, 30, 0, 262166, 30, 0, 262167, 21, 0, 262168, 30, 0, 262169, 30, 0, 262170, 30, 0, 262171, 30, 0, 262172, 30, 0, 262173, 30, 0, 262174, 30, 0, 262175, 30, 0, 262176, 30, 0, 262177, 30, 0, 262178, 30, 0, 262179, 30, 0, 262180, 30, 0, 393215, 0, 0, 327680, 0, 0, 327681, 0, 0, 327682, 0, 0, 327683, 1, 0, 327684, 0, 0, 327685, 0, 0, 327686, 0, 0, 327687, 0, 0, 327688, 0, 0, 327689, 0, 0, 327690, 10, 0, 327691, 1, 0, 327692, 1, 0, 327693, 10, 0, 327694, 10, 0, 327695, 10, 0, 327696, 10, 0, 327697, 10, 0, 327698, 0, 0, 327699, 7, 0, 327700, 30, 0, 327701, 30, 0, 327702, 30, 0, 327703, 21, 0, 327704, 30, 0, 327705, 30, 0, 327706, 30, 0, 327707, 30, 0, 327708, 30, 0, 327709, 30, 0, 327710, 30, 0, 327711, 30, 0, 327712, 30, 0, 327713, 30, 0, 327714, 30, 0, 327715, 30, 0, 327716, 30, 0, 458751, 2, 0, 393216, 2, 0, 393217, 2, 0, 393218, 2, 0, 393219, 12, 0, 393220, 2, 0, 393221, 2, 0, 393222, 2, 0, 393223, 2, 0, 393224, 2, 0, 393225, 2, 0, 393226, 2, 0, 393227, 12, 0, 393228, 12, 0, 393229, 2, 0, 393230, 2, 0, 393231, 2, 0, 393232, 2, 0, 393233, 6, 0, 393234, 2, 0, 393235, 27, 0, 393236, 22, 0, 393237, 22, 0, 393238, 22, 0, 393239, 32, 0, 393240, 22, 0, 393241, 22, 0, 393242, 22, 0, 393243, 22, 0, 393244, 22, 0, 393245, 22, 0, 393246, 22, 0, 393247, 22, 0, 393248, 22, 0, 393249, 22, 0, 393250, 26, 0, 393251, 22, 0, 393252, 22, 0, 524287, 2, 0, 458752, 2, 0, 458753, 2, 0, 458754, 2, 0, 458755, 12, 0, 458756, 2, 0, 458757, 2, 0, 458758, 2, 0, 458759, 2, 0, 458760, 2, 0, 458761, 2, 0, 458762, 2, 0, 458763, 12, 0, 458764, 12, 0, 458765, 2, 0, 458766, 2, 0, 458767, 2, 0, 458768, 2, 0, 458769, 5, 0, 458770, 2, 0, 458771, 29, 0, 458772, 22, 0, 458773, 22, 0, 458774, 22, 0, 458775, 32, 0, 458776, 22, 0, 458777, 22, 0, 458778, 22, 0, 458779, 22, 0, 458780, 26, 0, 458781, 22, 0, 458782, 22, 0, 458783, 22, 0, 458784, 22, 0, 458785, 22, 0, 458786, 25, 0, 458787, 22, 0, 458788, 22, 0, 589823, 0, 0, 524288, 10, 0, 524289, 10, 0, 524290, 10, 0, 524291, 1, 0, 524292, 10, 0, 524293, 10, 0, 524294, 10, 0, 524295, 10, 0, 524296, 10, 0, 524297, 10, 0, 524298, 10, 0, 524299, 1, 0, 524300, 1, 0, 524301, 10, 0, 524302, 10, 0, 524303, 10, 0, 524304, 10, 0, 524305, 10, 0, 524306, 0, 0, 524307, 7, 0, 524308, 30, 0, 524309, 30, 0, 524310, 30, 0, 524311, 21, 0, 524312, 30, 0, 524313, 30, 0, 524314, 30, 0, 524315, 30, 0, 524316, 21, 0, 524317, 30, 0, 524318, 30, 0, 524319, 30, 0, 524320, 30, 0, 524321, 30, 0, 524322, 30, 0, 524323, 30, 0, 524324, 30, 0, 655359, 0, 0, 589824, 10, 0, 589825, 10, 0, 589826, 10, 0, 589827, 1, 0, 589828, 10, 0, 589829, 10, 0, 589830, 10, 0, 589831, 10, 0, 589832, 10, 0, 589833, 10, 0, 589834, 10, 0, 589835, 1, 0, 589836, 1, 0, 589837, 10, 0, 589838, 10, 0, 589839, 10, 0, 589840, 10, 0, 589841, 10, 0, 589842, 0, 0, 589843, 7, 0, 589844, 30, 0, 589845, 30, 0, 589846, 30, 0, 589847, 21, 0, 589848, 30, 0, 589849, 30, 0, 589850, 30, 0, 589851, 30, 0, 589852, 21, 0, 589853, 30, 0, 589854, 30, 0, 589855, 30, 0, 589856, 30, 0, 589857, 30, 0, 589858, 30, 0, 589859, 30, 0, 589860, 30, 0, 720895, 0, 0, 655360, 10, 0, 655361, 10, 0, 655362, 10, 0, 655363, 1, 0, 655364, 10, 0, 655365, 10, 0, 655366, 10, 0, 655367, 10, 0, 655368, 10, 0, 655369, 10, 0, 655370, 10, 0, 655371, 1, 0, 655372, 1, 0, 655373, 10, 0, 655374, 10, 0, 655375, 10, 0, 655376, 10, 0, 655377, 10, 0, 655378, 0, 0, 655379, 7, 0, 655380, 30, 0, 655381, 30, 0, 655382, 30, 0, 655383, 21, 0, 655384, 30, 0, 655385, 30, 0, 655386, 30, 0, 655387, 30, 0, 655388, 21, 0, 655389, 30, 0, 655390, 30, 0, 655391, 30, 0, 655392, 30, 0, 655393, 30, 0, 655394, 30, 0, 655395, 30, 0, 655396, 30, 0, 786431, 0, 0, 720896, 10, 0, 720897, 10, 0, 720898, 10, 0, 720899, 1, 0, 720900, 10, 0, 720901, 10, 0, 720902, 10, 0, 720903, 10, 0, 720904, 10, 0, 720905, 10, 0, 720906, 10, 0, 720907, 1, 0, 720908, 1, 0, 720909, 10, 0, 720910, 10, 0, 720911, 10, 0, 720912, 10, 0, 720913, 10, 0, 720914, 0, 0, 720915, 7, 0, 720916, 30, 0, 720917, 30, 0, 720918, 30, 0, 720919, 21, 0, 720920, 30, 0, 720921, 30, 0, 720922, 30, 0, 720923, 30, 0, 720924, 21, 0, 720925, 30, 0, 720926, 30, 0, 720927, 30, 0, 720928, 30, 0, 720929, 30, 0, 720930, 30, 0, 720931, 30, 0, 720932, 30, 0, 851967, 0, 0, 786432, 10, 0, 786433, 10, 0, 786434, 10, 0, 786435, 15, 0, 786436, 2, 0, 786437, 2, 0, 786438, 2, 0, 786439, 2, 0, 786440, 2, 0, 786441, 2, 0, 786442, 2, 0, 786443, 12, 0, 786444, 4, 0, 786445, 10, 0, 786446, 10, 0, 786447, 10, 0, 786448, 10, 0, 786449, 10, 0, 786450, 0, 0, 786451, 7, 0, 786452, 30, 0, 786453, 30, 0, 786454, 30, 0, 786455, 21, 0, 786456, 30, 0, 786457, 30, 0, 786458, 30, 0, 786459, 30, 0, 786460, 21, 0, 786461, 30, 0, 786462, 30, 0, 786463, 30, 0, 786464, 30, 0, 786465, 30, 0, 786466, 30, 0, 786467, 30, 0, 786468, 30, 0, 917503, 0, 0, 851968, 10, 0, 851969, 10, 0, 851970, 10, 0, 851971, 10, 0, 851972, 10, 0, 851973, 10, 0, 851974, 10, 0, 851975, 10, 0, 851976, 10, 0, 851977, 10, 0, 851978, 10, 0, 851979, 1, 0, 851980, 1, 0, 851981, 10, 0, 851982, 10, 0, 851983, 10, 0, 851984, 10, 0, 851985, 10, 0, 851986, 0, 0, 851987, 7, 0, 851988, 30, 0, 851989, 33, 0, 851990, 22, 0, 851991, 31, 0, 851992, 22, 0, 851993, 22, 0, 851994, 22, 0, 851995, 22, 0, 851996, 31, 0, 851997, 22, 0, 851998, 22, 0, 851999, 22, 0, 852000, 22, 0, 852001, 22, 0, 852002, 22, 0, 852003, 22, 0, 852004, 22, 0, 983039, 2, 0, 917504, 2, 0, 917505, 14, 0, 917506, 10, 0, 917507, 10, 0, 917508, 10, 0, 917509, 10, 0, 917510, 10, 0, 917511, 10, 0, 917512, 10, 0, 917513, 10, 0, 917514, 10, 0, 917515, 1, 0, 917516, 3, 0, 917517, 2, 0, 917518, 2, 0, 917519, 2, 0, 917520, 2, 0, 917521, 2, 0, 917522, 2, 0, 917523, 27, 0, 917524, 22, 0, 917525, 36, 0, 917526, 30, 0, 917527, 21, 0, 917528, 30, 0, 917529, 30, 0, 917530, 30, 0, 917531, 30, 0, 917532, 21, 0, 917533, 30, 0, 917534, 30, 0, 917535, 30, 0, 917536, 30, 0, 917537, 30, 0, 917538, 30, 0, 917539, 30, 0, 917540, 30, 0, 1048575, 0, 0, 983040, 10, 0, 983041, 1, 0, 983042, 10, 0, 983043, 10, 0, 983044, 10, 0, 983045, 10, 0, 983046, 10, 0, 983047, 10, 0, 983048, 10, 0, 983049, 10, 0, 983050, 10, 0, 983051, 1, 0, 983052, 1, 0, 983053, 10, 0, 983054, 10, 0, 983055, 10, 0, 983056, 10, 0, 983057, 10, 0, 983058, 0, 0, 983059, 7, 0, 983060, 30, 0, 983061, 30, 0, 983062, 30, 0, 983063, 21, 0, 983064, 30, 0, 983065, 30, 0, 983066, 30, 0, 983067, 30, 0, 983068, 21, 0, 983069, 30, 0, 983070, 30, 0, 983071, 30, 0, 983072, 30, 0, 983073, 30, 0, 983074, 30, 0, 983075, 30, 0, 983076, 30, 0, 1114111, 0, 0, 1048576, 10, 0, 1048577, 1, 0, 1048578, 10, 0, 1048579, 10, 0, 1048580, 10, 0, 1048581, 10, 0, 1048582, 10, 0, 1048583, 10, 0, 1048584, 10, 0, 1048585, 10, 0, 1048586, 10, 0, 1048587, 1, 0, 1048588, 1, 0, 1048589, 10, 0, 1048590, 10, 0, 1048591, 10, 0, 1048592, 10, 0, 1048593, 10, 0, 1048594, 0, 0, 1048595, 7, 0, 1048596, 30, 0, 1048597, 30, 0, 1048598, 30, 0, 1048599, 21, 0, 1048600, 30, 0, 1048601, 30, 0, 1048602, 30, 0, 1048603, 30, 0, 1048604, 21, 0, 1048605, 30, 0, 1048606, 30, 0, 1048607, 30, 0, 1048608, 30, 0, 1048609, 30, 0, 1048610, 30, 0, 1048611, 30, 0, 1048612, 30, 0, 1179647, 0, 0, 1114112, 0, 0, 1114113, 1, 0, 1114114, 0, 0, 1114115, 0, 0, 1114116, 0, 0, 1114117, 0, 0, 1114118, 0, 0, 1114119, 0, 0, 1114120, 0, 0, 1114121, 0, 0, 1114122, 0, 0, 1114123, 1, 0, 1114124, 1, 0, 1114125, 0, 0, 1114126, 0, 0, 1114127, 0, 0, 1114128, 0, 0, 1114129, 0, 0, 1114130, 0, 0, 1114131, 7, 0, 1114132, 30, 0, 1114133, 30, 0, 1114134, 30, 0, 1114135, 21, 0, 1114136, 30, 0, 1114137, 30, 0, 1114138, 30, 0, 1114139, 30, 0, 1114140, 21, 0, 1114141, 30, 0, 1114142, 30, 0, 1114143, 30, 0, 1114144, 30, 0, 1114145, 30, 0, 1114146, 30, 0, 1114147, 30, 0, 1114148, 30, 0 ) | ||
_sections_unfolded = [ "Cell" ] | ||
|
||
[node name="Player" parent="." index="1" instance=ExtResource( 3 )] | ||
|
||
|
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
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,18 @@ | ||
extends Node | ||
|
||
var tile_size = Vector2(128, 128) | ||
onready var texture = $Sprite.texture | ||
|
||
func _ready(): | ||
var tex_width = texture.get_width() / tile_size.x | ||
var tex_height= texture.get_height() / tile_size.y | ||
var ts = TileSet.new() | ||
for x in range(tex_width): | ||
for y in range(tex_height): | ||
var region = Rect2(x * tile_size.x, y * tile_size.y, | ||
tile_size.x, tile_size.y) | ||
var id = x + y * 10 | ||
ts.create_tile(id) | ||
ts.tile_set_texture(id, texture) | ||
ts.tile_set_region(id, region) | ||
ResourceSaver.save("res://terrain/terrain_tiles.tres", ts) |
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,14 @@ | ||
[gd_scene load_steps=3 format=2] | ||
|
||
[ext_resource path="res://terrain/TileSetMaker.gd" type="Script" id=1] | ||
[ext_resource path="res://assets/terrainTiles_retina.png" type="Texture" id=2] | ||
|
||
[node name="TileSetMaker" type="Node" index="0"] | ||
|
||
script = ExtResource( 1 ) | ||
|
||
[node name="Sprite" type="Sprite" parent="." index="0"] | ||
|
||
texture = ExtResource( 2 ) | ||
|
||
|
Oops, something went wrong.