Skip to content

Commit

Permalink
updated code a lot
Browse files Browse the repository at this point in the history
  • Loading branch information
amzker committed Nov 1, 2022
1 parent 5ae139d commit 42e1086
Show file tree
Hide file tree
Showing 16 changed files with 197 additions and 158 deletions.
89 changes: 1 addition & 88 deletions assets/tiles/maintileset.tres
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
[gd_resource type="TileSet" load_steps=8 format=2]
[gd_resource type="TileSet" load_steps=7 format=2]

[ext_resource path="res://assets/images/tileset.png" type="Texture" id=1]
[ext_resource path="res://assets/images/player.png" type="Texture" id=2]

[sub_resource type="ConvexPolygonShape2D" id=1]
points = PoolVector2Array( 0, 0, 64, 0, 64, 64, 0, 64 )

[sub_resource type="ConvexPolygonShape2D" id=2]
points = PoolVector2Array( 0, 0, 160, 0, 160, 64, 0, 64 )

[sub_resource type="ConvexPolygonShape2D" id=3]
points = PoolVector2Array( 64, 64, 0, 64, 32, 32, 64, 0 )

Expand Down Expand Up @@ -40,90 +37,6 @@ points = PoolVector2Array( 64, 64, 0, 64, 0, 0, 64, 0 )
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
0/z_index = 0
1/name = "tileset.png 1"
1/texture = ExtResource( 1 )
1/tex_offset = Vector2( 0, 0 )
1/modulate = Color( 1, 1, 1, 1 )
1/region = Rect2( 96, 96, 32, 32 )
1/tile_mode = 0
1/occluder_offset = Vector2( 0, 0 )
1/navigation_offset = Vector2( 0, 0 )
1/shape_offset = Vector2( 0, 0 )
1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
1/shape = SubResource( 2 )
1/shape_one_way = false
1/shape_one_way_margin = 1.0
1/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 )
} ]
1/z_index = 0
2/name = "tileset.png 2"
2/texture = ExtResource( 1 )
2/tex_offset = Vector2( 0, 0 )
2/modulate = Color( 1, 1, 1, 1 )
2/region = Rect2( 32, 96, 32, 32 )
2/tile_mode = 0
2/occluder_offset = Vector2( 0, 0 )
2/navigation_offset = Vector2( 0, 0 )
2/shape_offset = Vector2( 0, 0 )
2/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
2/shape_one_way = false
2/shape_one_way_margin = 0.0
2/shapes = [ ]
2/z_index = 0
3/name = "tileset.png 3"
3/texture = ExtResource( 1 )
3/tex_offset = Vector2( 0, 0 )
3/modulate = Color( 1, 1, 1, 1 )
3/region = Rect2( 96, 128, 32, 64 )
3/tile_mode = 2
3/autotile/icon_coordinate = Vector2( 0, 0 )
3/autotile/tile_size = Vector2( 32, 32 )
3/autotile/spacing = 0
3/autotile/occluder_map = [ ]
3/autotile/navpoly_map = [ ]
3/autotile/priority_map = [ ]
3/autotile/z_index_map = [ ]
3/occluder_offset = Vector2( 0, 0 )
3/navigation_offset = Vector2( 0, 0 )
3/shape_offset = Vector2( 0, 0 )
3/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
3/shape_one_way = false
3/shape_one_way_margin = 0.0
3/shapes = [ ]
3/z_index = 0
4/name = "tileset.png 4"
4/texture = ExtResource( 1 )
4/tex_offset = Vector2( 0, 0 )
4/modulate = Color( 1, 1, 1, 1 )
4/region = Rect2( 96, 128, 32, 96 )
4/tile_mode = 0
4/occluder_offset = Vector2( 0, 0 )
4/navigation_offset = Vector2( 0, 0 )
4/shape_offset = Vector2( 0, 0 )
4/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
4/shape_one_way = false
4/shape_one_way_margin = 0.0
4/shapes = [ ]
4/z_index = 0
5/name = "tileset.png 5"
5/texture = ExtResource( 1 )
5/tex_offset = Vector2( 0, 0 )
5/modulate = Color( 1, 1, 1, 1 )
5/region = Rect2( 32, 96, 32, 32 )
5/tile_mode = 0
5/occluder_offset = Vector2( 0, 0 )
5/navigation_offset = Vector2( 0, 0 )
5/shape_offset = Vector2( 0, 0 )
5/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
5/shape_one_way = false
5/shape_one_way_margin = 0.0
5/shapes = [ ]
5/z_index = 0
6/name = "tileset.png 6"
6/texture = ExtResource( 1 )
6/tex_offset = Vector2( 0, 0 )
Expand Down
1 change: 1 addition & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ pointing/emulate_touch_from_mouse=true
2d_physics/layer_3="coins"
2d_physics/layer_4="world"
2d_physics/layer_5="AI"
2d_physics/layer_6="Gzero"

[network]

Expand Down
21 changes: 21 additions & 0 deletions src/TRlevels/lvpaths/lv5path.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,24 @@ position = Vector2( 5884, 703 )

[node name="coin13" parent="." instance=ExtResource( 1 )]
position = Vector2( 6184, 727 )

[node name="coin14" parent="." instance=ExtResource( 1 )]
position = Vector2( 6709, 727 )

[node name="coin15" parent="." instance=ExtResource( 1 )]
position = Vector2( 8088, 713 )

[node name="coin16" parent="." instance=ExtResource( 1 )]
position = Vector2( 8384, 700 )

[node name="coin17" parent="." instance=ExtResource( 1 )]
position = Vector2( 9292, 1393 )

[node name="coin18" parent="." instance=ExtResource( 1 )]
position = Vector2( 9723, 1252 )

[node name="coin19" parent="." instance=ExtResource( 1 )]
position = Vector2( 10039, 969 )

[node name="coin20" parent="." instance=ExtResource( 1 )]
position = Vector2( 10717, 438 )
51 changes: 26 additions & 25 deletions src/UI/WELCOME.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use_filter = true
font_data = ExtResource( 2 )

[node name="WELCOME" type="Node2D"]
position = Vector2( 50, 0 )
script = ExtResource( 3 )

[node name="Background" type="TextureRect" parent="."]
Expand All @@ -27,21 +28,21 @@ margin_bottom = 835.034
texture = ExtResource( 1 )

[node name="repeat" type="CheckButton" parent="."]
margin_left = 359.0
margin_top = 17.0
margin_right = 550.0
margin_bottom = 83.0
margin_left = 357.0
margin_top = 92.0
margin_right = 548.0
margin_bottom = 151.0
hint_tooltip = "it will automatically restart same level when you die. press M to come back for menu"
custom_fonts/font = SubResource( 1 )
pressed = true
button_mask = 3
text = "REPEAT"

[node name="vsai" type="CheckButton" parent="."]
margin_left = 360.189
margin_top = 82.2616
margin_right = 551.188
margin_bottom = 148.262
margin_left = 358.0
margin_top = 152.0
margin_right = 549.0
margin_bottom = 207.0
custom_fonts/font = SubResource( 1 )
pressed = true
text = "P Vs AI"
Expand All @@ -51,10 +52,10 @@ anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = 361.354
margin_top = 295.672
margin_right = 504.354
margin_bottom = 350.672
margin_left = 359.355
margin_top = 348.672
margin_right = 502.355
margin_bottom = 403.672
rect_scale = Vector2( 1.32, 1.24 )
custom_fonts/font = ExtResource( 6 )
text = "PLAY ALONE"
Expand All @@ -73,28 +74,28 @@ shortcut for main menu: M
shortcut for restart & play : Enter (2x)"

[node name="OptionButton" type="OptionButton" parent="."]
margin_left = 360.354
margin_top = 163.672
margin_right = 548.354
margin_bottom = 207.672
margin_left = 358.354
margin_top = 216.672
margin_right = 546.354
margin_bottom = 260.672
custom_fonts/font = ExtResource( 6 )
text = "level1"
items = [ "level1", null, false, 0, null, "level2", null, false, 1, null, "level3", null, false, 2, null, "testlv", null, false, 3, null, "level4", null, false, 4, null, "level5", null, false, 5, null ]
selected = 0

[node name="multiplayer" type="Button" parent="."]
margin_left = 360.354
margin_top = 371.672
margin_right = 549.354
margin_bottom = 431.672
margin_left = 358.354
margin_top = 424.672
margin_right = 547.354
margin_bottom = 484.672
custom_fonts/font = ExtResource( 6 )
text = "GO MULTIPLAYER"

[node name="LineEdit" type="LineEdit" parent="."]
margin_left = 361.354
margin_top = 237.672
margin_right = 548.354
margin_bottom = 261.672
margin_left = 359.354
margin_top = 290.672
margin_right = 546.354
margin_bottom = 314.672
align = 1
placeholder_text = "Your Unholy Name"

Expand All @@ -109,7 +110,7 @@ text = "MUSIC"
[node name="TileMap" type="TileMap" parent="."]
tile_set = ExtResource( 4 )
format = 1
tile_data = PoolIntArray( 65533, 0, 0, 3, 8, 0, 4, -1610612728, 0, 9, 8, 0, 10, -1610612728, 0, 16, 0, 0, 131069, 0, 0, 65539, 1610612743, 0, 65540, 1610612742, 0, 65545, -1073741818, 0, 65546, 1610612743, 0, 65552, 0, 0, 196605, 0, 0, 131075, 1610612743, 0, 131082, 1610612743, 0, 131088, 0, 0, 262141, 0, 0, 196611, 1610612743, 0, 196618, 1610612743, 0, 196624, 0, 0, 327677, 0, 0, 262147, 1610612743, 0, 262154, 1610612743, 0, 262160, 0, 0, 393213, 0, 0, 327683, 1610612743, 0, 327684, -1610612730, 0, 327689, 6, 0, 327690, 1610612743, 0, 327696, 0, 0, 458749, 0, 0, 393219, -1073741816, 0, 393220, 1610612744, 0, 393225, -1073741816, 0, 393226, 1610612744, 0, 393232, 0, 0, 524285, 0, 0, 458768, 0, 0, 589821, 0, 0, 524304, 0, 0, 655357, 0, 0, 589840, 0, 0, 720893, 0, 0, 655376, 7, 0, 786429, 0, 0, 720912, 7, 0, 851965, 0, 0, 851966, 0, 0, 851967, 0, 0, 786432, 7, 0, 786433, 7, 0, 786434, 7, 0, 786435, 7, 0, 786436, 7, 0, 786437, 7, 0, 786438, 7, 0, 786439, 7, 0, 786440, 7, 0, 786441, 7, 0, 786442, 7, 0, 786443, 7, 0, 786444, 7, 0, 786445, 7, 0, 786446, 7, 0, 786447, 7, 0, 786448, 7, 0 )
tile_data = PoolIntArray( 65533, 0, 0, 16, 0, 0, 131069, 0, 0, 65539, 6, 0, 65540, 1610612742, 0, 65545, -1073741818, 0, 65546, -1610612730, 0, 65552, 0, 0, 196605, 0, 0, 131075, 1610612743, 0, 131082, 1610612743, 0, 131088, 0, 0, 262141, 0, 0, 196611, 1610612743, 0, 196618, 1610612743, 0, 196624, 0, 0, 327677, 0, 0, 262147, 1610612743, 0, 262154, 1610612743, 0, 262160, 0, 0, 393213, 0, 0, 327683, 1610612743, 0, 327690, 1610612743, 0, 327696, 0, 0, 458749, 0, 0, 393219, 7, 0, 393226, 7, 0, 393232, 0, 0, 524285, 0, 0, 458755, -1073741818, 0, 458756, -1610612730, 0, 458761, 6, 0, 458762, 1610612742, 0, 458768, 0, 0, 589821, 0, 0, 524304, 0, 0, 655357, 0, 0, 589840, 0, 0, 720893, 0, 0, 655376, 7, 0, 786429, 0, 0, 720912, 7, 0, 851965, 0, 0, 851966, 0, 0, 851967, 0, 0, 786432, 7, 0, 786433, 7, 0, 786434, 7, 0, 786435, 7, 0, 786436, 7, 0, 786437, 7, 0, 786438, 7, 0, 786439, 7, 0, 786440, 7, 0, 786441, 7, 0, 786442, 7, 0, 786443, 7, 0, 786444, 7, 0, 786445, 7, 0, 786446, 7, 0, 786447, 7, 0, 786448, 7, 0 )

[connection signal="toggled" from="repeat" to="." method="_on_repeat_toggled"]
[connection signal="toggled" from="vsai" to="." method="_on_vsai_toggled"]
Expand Down
7 changes: 2 additions & 5 deletions src/UI/lvloader.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ func _ready():
if Variables.multp:
pass
else:
if "testlv" in Variables.LEVEL:
pass
else:
pl = load(pl).instance()
add_child(pl)
pl = load(pl).instance()
add_child(pl)

func setup_players_positions() -> void:
for player in Persistent_nodes.get_children():
Expand Down
2 changes: 1 addition & 1 deletion src/UI/variables.gd
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func _on_OptionButton_item_selected(index):
LEVEL = str("res://src/levels/",op,".tscn")
Variables.LEVEL = LEVEL
Variables.AI_CONFIG = str(op)
print(op)
#print(op)


func _on_playb_pressed():
Expand Down
5 changes: 1 addition & 4 deletions src/actors/AI.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,19 @@ var fitness = 0
var coinsbyai = 0

func _ready():
#THIS STARTPOSI , ENDPOSI , CURRENTPOSI DOES NOT REQUIRE AT ALL BUT KEPT HERE AS IF YOU WANT TO INCLUDE THEM IN TRAINING AS SENSES
if Variables.TRMODE:
#print("At trmode true")
startposition = get_node("/root/trainer/testlv/Start").position #testlv/Start.position #testlv is main node name of all levels and will be availible when ai added to it as childS
ENDRPOSI = get_node("/root/trainer/testlv/ENDR").position
else:
#print("At trmode false")
currentposi = self.position
if Variables.vsai:
#print("at vsai true")
ENDRPOSI = get_node("/root/AIvsPlayer/testlv/ENDR").position
else:
if "testlv" in Variables.LEVEL:
pass
else:
ENDRPOSI = get_node("/root/lvloader/testlv/ENDR").position
#print("endposi after", ENDRPOSI)

func get_direction(rightst,leftst,jumpp) -> Vector2:
return Vector2(rightst - leftst , -1 if jumpp and is_on_floor() else 1)
Expand Down
3 changes: 2 additions & 1 deletion src/actors/actor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const FLOOR_NORMAL: = Vector2.UP
var _velocity: = Vector2.ZERO
export var speed: = Vector2(900, 600)
export var AIspeed: = Vector2(900,600)
export var gravity: = 900
var gravity = 900




Expand Down
4 changes: 4 additions & 0 deletions src/actors/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ func _ready():
$player_name.text = plname
else:
camera.make_current()

func change_gravity(Gvalue):
gravity = Gvalue


func calc_velocity(linear_velocity: Vector2 ,speed : Vector2, direction: Vector2, is_jump_stopped: bool) -> Vector2:
var out = linear_velocity
out.x = speed.x * direction.x
Expand Down
2 changes: 1 addition & 1 deletion src/actors/player.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ extents = Vector2( 49.25, 38 )

[node name="player" type="KinematicBody2D" groups=["Player"]]
position = Vector2( 0, 1 )
collision_mask = 25
collision_mask = 57
script = ExtResource( 2 )

[node name="Tween" type="Tween" parent="."]
Expand Down
10 changes: 10 additions & 0 deletions src/levels/basic_lv_script.gd
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,13 @@ func _on_RestartB_pressed():
get_tree().change_scene("res://AI/AIvsPlayer.tscn")
else:
get_tree().change_scene("res://src/UI/lvloader.tscn")



func _on_zeroG_body_entered(body):
if body.has_method("change_gravity"):
body.change_gravity(-100)

func _on_zeroG_body_exited(body):
if body.has_method("change_gravity"):
body.change_gravity(900)
2 changes: 1 addition & 1 deletion src/levels/level2.tscn

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/levels/level4.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ position = Vector2( 4590.91, 95.271 )
position = Vector2( 4828.76, 95.271 )

[node name="coin5" parent="." instance=ExtResource( 5 )]
position = Vector2( 6173, 90 )
position = Vector2( 6230, 90 )

[node name="coin6" parent="." instance=ExtResource( 5 )]
position = Vector2( 6278.55, 95.271 )
Expand Down
Loading

0 comments on commit 42e1086

Please sign in to comment.