-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
936 changed files
with
20,976 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,15 @@ | ||
extends AnimatedSprite | ||
|
||
# class member variables go here, for example: | ||
# var a = 2 | ||
# var b = "textvar" | ||
|
||
func _ready(): | ||
# Called every time the node is added to the scene. | ||
# Initialization here | ||
pass | ||
|
||
#func _process(delta): | ||
# # Called every frame. Delta is time since last frame. | ||
# # Update game logic here. | ||
# pass |
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,8 @@ | ||
extends AnimatedSprite | ||
|
||
|
||
func _ready(): | ||
pass | ||
|
||
|
||
|
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 KinematicBody2D | ||
|
||
|
||
|
||
func _on_AreaTop_area_entered(area): | ||
global_position.y += 1 | ||
|
||
|
||
func _on_AreaRight_area_entered(area): | ||
global_position.x += 1 | ||
|
||
|
||
func _on_AreaBottom_area_entered(area): | ||
global_position.y -= 1 | ||
|
||
|
||
func _on_AreaLeft_area_entered(area): | ||
global_position.x -= 1 |
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,16 @@ | ||
[gd_scene format=2] | ||
|
||
[node name="EndGameScreen" type="Node2D"] | ||
|
||
[node name="CanvasLayer" type="CanvasLayer" parent="."] | ||
|
||
[node name="Label" type="Label" parent="CanvasLayer"] | ||
visible = false | ||
modulate = Color( 1, 0, 0, 1 ) | ||
margin_right = 1336.0 | ||
margin_bottom = 722.0 | ||
text = "Game ended | ||
" | ||
align = 1 | ||
valign = 1 | ||
|
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,26 @@ | ||
extends RigidBody2D | ||
# | ||
#var SPEED = 150 | ||
# | ||
# | ||
# | ||
##func _physics_process(delta): | ||
#func _on_Body_area_entered(area): | ||
# var MOVE = Vector2() | ||
# var body = get_node("../Enemy1/Body").get_overlapping_bodies() | ||
# var groups = area.get_groups() | ||
# if(body.size() != 0): | ||
# for tinge in body: | ||
# | ||
# #if(tinge.is_in_group("player")): | ||
# (groups.has("player")): | ||
# print('kek') | ||
# #if(tinge.global_position().x < self.global_position().x): | ||
# global_position.x += -10 | ||
|
||
|
||
|
||
#func _on_Body_area_entered(area): | ||
# var groups = area.get_groups() | ||
# if (groups.has("player")): | ||
# global_position.x += 10 |
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,66 @@ | ||
[gd_scene load_steps=14 format=2] | ||
|
||
[ext_resource path="res://Enemy1.gd" type="Script" id=1] | ||
[ext_resource path="res://KinematicEnemy1.gd" type="Script" id=2] | ||
[ext_resource path="res://enemy/amg1_lf1.png" type="Texture" id=3] | ||
[ext_resource path="res://enemy/amg1_lf2.png" type="Texture" id=4] | ||
[ext_resource path="res://enemy/amg1_rt1.png" type="Texture" id=5] | ||
[ext_resource path="res://enemy/amg1_rt2.png" type="Texture" id=6] | ||
[ext_resource path="res://enemy/amg1_bk1.png" type="Texture" id=7] | ||
[ext_resource path="res://enemy/amg1_bk2.png" type="Texture" id=8] | ||
[ext_resource path="res://enemy/amg1_fr1.png" type="Texture" id=9] | ||
[ext_resource path="res://enemy/amg1_fr2.png" type="Texture" id=10] | ||
|
||
[sub_resource type="CapsuleShape2D" id=1] | ||
radius = 15.6866 | ||
height = 13.8927 | ||
|
||
[sub_resource type="SpriteFrames" id=2] | ||
animations = [ { | ||
"frames": [ ExtResource( 3 ), ExtResource( 4 ) ], | ||
"loop": true, | ||
"name": "LEFT", | ||
"speed": 5.0 | ||
}, { | ||
"frames": [ ExtResource( 5 ), ExtResource( 6 ) ], | ||
"loop": true, | ||
"name": "RIGHT", | ||
"speed": 5.0 | ||
}, { | ||
"frames": [ ExtResource( 7 ), ExtResource( 8 ) ], | ||
"loop": true, | ||
"name": "UP", | ||
"speed": 5.0 | ||
}, { | ||
"frames": [ ExtResource( 9 ), ExtResource( 10 ) ], | ||
"loop": true, | ||
"name": "DOWN", | ||
"speed": 5.0 | ||
} ] | ||
|
||
[sub_resource type="CircleShape2D" id=3] | ||
radius = 246.873 | ||
|
||
[node name="Enemy1" type="Node2D"] | ||
|
||
[node name="Enemy1" type="RigidBody2D" parent="."] | ||
mode = 2 | ||
gravity_scale = 0.0 | ||
script = ExtResource( 1 ) | ||
|
||
[node name="KinematicEnemy1" type="KinematicBody2D" parent="."] | ||
script = ExtResource( 2 ) | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="KinematicEnemy1"] | ||
shape = SubResource( 1 ) | ||
|
||
[node name="AnimatedSprite" type="AnimatedSprite" parent="KinematicEnemy1"] | ||
frames = SubResource( 2 ) | ||
animation = "RIGHT" | ||
|
||
[node name="Body" type="Area2D" parent="KinematicEnemy1"] | ||
|
||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="KinematicEnemy1/Body"] | ||
position = Vector2( -0.71698, 0 ) | ||
shape = SubResource( 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
extends KinematicBody2D | ||
|
||
|
||
var SPEED = 150 | ||
|
||
|
||
|
||
func _physics_process(delta): | ||
|
||
var MOVE = Vector2() | ||
var body = get_node("Body").get_overlapping_bodies() | ||
|
||
if(body.size() != 0): | ||
for tinge in body: | ||
if(tinge.is_in_group("player")): | ||
print('kek') | ||
#if(tinge.global_position().x < self.global_position().x): | ||
# print('good') |
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,130 @@ | ||
extends KinematicBody2D | ||
|
||
const SPEED = 200 | ||
|
||
var movedir = Vector2(0,0) | ||
var spritedir = "down" | ||
var can_go = true | ||
var can_fire = false | ||
var how_fire = Vector2() | ||
var fire_rotate = 0 | ||
var time = 5 | ||
var shoot_time = 1 | ||
var is_live = true | ||
|
||
var health = 40 | ||
|
||
var Bullet = preload('res://player/Bullet.tscn') | ||
|
||
func fire(): | ||
var bul = Bullet.instance() | ||
bul.position = position + how_fire | ||
bul.rotation_degrees = fire_rotate | ||
get_node('../').add_child(bul) | ||
time = 0 | ||
$"../".change_map("Dung") | ||
|
||
func _physics_process(delta): | ||
controls_loop() | ||
movement_loop() | ||
spritedir_loop() | ||
|
||
time += delta | ||
if (time > shoot_time): | ||
time = 5 | ||
|
||
$"../"/Bars/Player_bars/player1_mana_bar.set_value(time) | ||
$"../"/Bars/Player_bars/player1_health_bar.set_value(health) | ||
|
||
if (health == 0): | ||
health = -1 | ||
time = 0 | ||
is_live = false | ||
$"../"/EndGameScreen/CanvasLayer/Label.show() | ||
|
||
if (time > 1.4 and is_live == false): | ||
get_tree().paused = true | ||
|
||
#if is_on_wall(): | ||
if (Input.is_action_pressed("ui_fire")): | ||
|
||
if spritedir == "left":# and test_move(transform, Vector2(-1,0)): | ||
$anim.play("pushleft") | ||
can_go = false | ||
can_fire = false | ||
fire_rotate = -180 | ||
how_fire = Vector2(-10, 2) | ||
if (time > shoot_time): | ||
fire() | ||
#anim_switch("push") | ||
if spritedir == "right":# and test_move(transform, Vector2(1,0)): | ||
$anim.play("pushright") | ||
can_go = false | ||
can_fire = false | ||
fire_rotate = 0 | ||
how_fire = Vector2(10, 2) | ||
if (time > shoot_time): | ||
fire() | ||
#anim_switch("push") | ||
if spritedir == "up":# and test_move(transform, Vector2(0,-1)): | ||
$anim.play("pushup") | ||
can_go = false | ||
can_fire = false | ||
fire_rotate = -90 | ||
how_fire = Vector2(0, -10) | ||
if (time > shoot_time): | ||
fire() | ||
#anim_switch("push") | ||
if spritedir == "down":# and test_move(transform, Vector2(0,1)): | ||
$anim.play("pushdown") | ||
can_go = false | ||
can_fire = false | ||
fire_rotate = 90 | ||
how_fire = Vector2(0, 10) | ||
if (time > shoot_time): | ||
fire() | ||
#anim_switch("push") | ||
elif movedir != Vector2(0,0): | ||
anim_switch("walk") | ||
can_go = true | ||
can_fire = true | ||
else: | ||
anim_switch("idle") | ||
can_go = true | ||
can_fire = true | ||
|
||
|
||
func controls_loop(): | ||
var LEFT = Input.is_action_pressed("ui_left") | ||
var RIGHT = Input.is_action_pressed("ui_right") | ||
var UP = Input.is_action_pressed("ui_up") | ||
var DOWN = Input.is_action_pressed("ui_down") | ||
|
||
if (can_fire == false): | ||
movedir.x = 0 | ||
movedir.y = 0 | ||
if (can_go == true): | ||
movedir.x = -int(LEFT) + int(RIGHT) | ||
movedir.y = -int(UP) + int(DOWN) | ||
|
||
func movement_loop(): | ||
var motion = movedir.normalized() * SPEED | ||
move_and_slide(motion, Vector2(0,0)) | ||
|
||
func spritedir_loop(): | ||
|
||
match movedir: | ||
Vector2(-1,0): | ||
spritedir = "left" | ||
Vector2(1,0): | ||
spritedir = "right" | ||
Vector2(0,-1): | ||
spritedir = "up" | ||
Vector2(0,1): | ||
spritedir = "down" | ||
|
||
func anim_switch(animation): | ||
var newanim = str(animation, spritedir) | ||
if $anim.current_animation != newanim: | ||
$anim.play(newanim) | ||
|
Oops, something went wrong.