From 1bf6b36231cfe2560b17906d0a3aa4a65a1954ee Mon Sep 17 00:00:00 2001 From: Moonshrike Date: Fri, 5 Nov 2021 18:55:01 +0200 Subject: [PATCH] commit --- .../movementSystem0.0.4}/Bullet.tscn | 2 +- .../movementSystem0.0.4}/Env.tscn | 2 +- Alens/movementSystem0.0.4/Gun.gd | 26 +++++++++++ Alens/movementSystem0.0.4/Player.tscn | 19 ++++++++ Alens/movementSystem0.0.4/game.tscn | 38 ++++++++++++++++ .../movementSystem0.0.4/pixil-frame-0 (1).png | Bin 0 -> 29132 bytes .../pixil-frame-0 (1).png.import | 34 ++++++++++++++ .../movementSystem0.0.4/pixilart-drawing.png | Bin 0 -> 818 bytes .../pixilart-drawing.png.import | 34 ++++++++++++++ .../movementSystem0.0.4/script}/Bullet.gd | 36 ++++----------- .../movementSystem0.0.4/script}/Env.gd | 7 +-- Alens/movementSystem0.0.4/script/Gun.gd | 26 +++++++++++ .../script}/KinematicBody2D.gd | 2 +- .../movementSystem0.0.4/script}/Mob.gd | 0 .../trinity_site/trinity-site-level.tscn | 15 +++++- Pavels/bullet_trajectory/Gun.gd | 4 -- .../Hyperbolic_Barrel.tscn | 22 +++++++++ .../Hyperbolic_Bullet.tscn | 22 +++++++++ .../Hyperbolic_Trajectory/Hyperbolic_Env.tscn | 12 +++++ .../Line_Trajectory/Line_Barrel.tscn | 22 +++++++++ .../Line_Trajectory/Line_Bullet.tscn | 22 +++++++++ .../Line_Trajectory/Line_Env.tscn | 10 ++++ .../Parabolic_Barrel.tscn | 22 +++++++++ .../Parabolic_Bullet.tscn | 22 +++++++++ .../Parabolic_Trajectory/Parabolic_Env.tscn | 12 +++++ Pavels/bullet_trajectory/Player.tscn | 2 +- .../Sine_Trajectory/Sine_Barrel.tscn | 22 +++++++++ .../Sine_Trajectory/Sine_Bullet.tscn | 22 +++++++++ .../Sine_Trajectory/Sine_Env.tscn | 12 +++++ Pavels/bullet_trajectory/game.tscn | 11 ++--- Pavels/bullet_trajectory/project.godot | 12 +---- Pavels/bullet_trajectory/script/Gun.gd | 30 ++++++++++++ .../script/Hyperbola/Hyperbolic_Barrel.gd | 16 +++++++ .../script/Hyperbola/Hyperbolic_Bullet.gd | 24 ++++++++++ .../script/Hyperbola/Hyperbolic_Env.gd | 10 ++++ .../script/KinematicBody2D.gd | 26 +++++++++++ .../script/Line/Line_Barrel.gd | 16 +++++++ .../script/Line/Line_Bullet.gd | 43 ++++++++++++++++++ .../bullet_trajectory/script/Line/Line_Env.gd | 9 ++++ Pavels/bullet_trajectory/script/Mob.gd | 10 ++++ .../script/Parabola/Parabolic_Barrel.gd | 16 +++++++ .../script/Parabola/Parabolic_Bullet.gd | 24 ++++++++++ .../script/Parabola/Parabolic_Env.gd | 9 ++++ .../script/Sine/Sine_Barrel.gd | 20 ++++++++ .../script/Sine/Sine_Bullet.gd | 25 ++++++++++ .../bullet_trajectory/script/Sine/Sine_Env.gd | 9 ++++ ...r.svg-297905206d682966af5dba035b7d5368.md5 | 2 +- ...e.svg-eb5ce7ff66dca983c1acbf7134c96e32.md5 | 2 +- ...r.svg-297905206d682966af5dba035b7d5368.md5 | 2 +- ...e.svg-eb5ce7ff66dca983c1acbf7134c96e32.md5 | 2 +- 50 files changed, 722 insertions(+), 65 deletions(-) rename {Pavels/bullet_trajectory => Alens/movementSystem0.0.4}/Bullet.tscn (90%) rename {Pavels/bullet_trajectory => Alens/movementSystem0.0.4}/Env.tscn (80%) create mode 100644 Alens/movementSystem0.0.4/Gun.gd create mode 100644 Alens/movementSystem0.0.4/Player.tscn create mode 100644 Alens/movementSystem0.0.4/game.tscn create mode 100644 Alens/movementSystem0.0.4/pixil-frame-0 (1).png create mode 100644 Alens/movementSystem0.0.4/pixil-frame-0 (1).png.import create mode 100644 Alens/movementSystem0.0.4/pixilart-drawing.png create mode 100644 Alens/movementSystem0.0.4/pixilart-drawing.png.import rename {Pavels/bullet_trajectory => Alens/movementSystem0.0.4/script}/Bullet.gd (55%) rename {Pavels/bullet_trajectory => Alens/movementSystem0.0.4/script}/Env.gd (70%) create mode 100644 Alens/movementSystem0.0.4/script/Gun.gd rename {Pavels/bullet_trajectory => Alens/movementSystem0.0.4/script}/KinematicBody2D.gd (93%) rename {Pavels/bullet_trajectory => Alens/movementSystem0.0.4/script}/Mob.gd (100%) delete mode 100644 Pavels/bullet_trajectory/Gun.gd create mode 100644 Pavels/bullet_trajectory/Hyperbolic_Trajectory/Hyperbolic_Barrel.tscn create mode 100644 Pavels/bullet_trajectory/Hyperbolic_Trajectory/Hyperbolic_Bullet.tscn create mode 100644 Pavels/bullet_trajectory/Hyperbolic_Trajectory/Hyperbolic_Env.tscn create mode 100644 Pavels/bullet_trajectory/Line_Trajectory/Line_Barrel.tscn create mode 100644 Pavels/bullet_trajectory/Line_Trajectory/Line_Bullet.tscn create mode 100644 Pavels/bullet_trajectory/Line_Trajectory/Line_Env.tscn create mode 100644 Pavels/bullet_trajectory/Parabolic_Trajectory/Parabolic_Barrel.tscn create mode 100644 Pavels/bullet_trajectory/Parabolic_Trajectory/Parabolic_Bullet.tscn create mode 100644 Pavels/bullet_trajectory/Parabolic_Trajectory/Parabolic_Env.tscn create mode 100644 Pavels/bullet_trajectory/Sine_Trajectory/Sine_Barrel.tscn create mode 100644 Pavels/bullet_trajectory/Sine_Trajectory/Sine_Bullet.tscn create mode 100644 Pavels/bullet_trajectory/Sine_Trajectory/Sine_Env.tscn create mode 100644 Pavels/bullet_trajectory/script/Gun.gd create mode 100644 Pavels/bullet_trajectory/script/Hyperbola/Hyperbolic_Barrel.gd create mode 100644 Pavels/bullet_trajectory/script/Hyperbola/Hyperbolic_Bullet.gd create mode 100644 Pavels/bullet_trajectory/script/Hyperbola/Hyperbolic_Env.gd create mode 100644 Pavels/bullet_trajectory/script/KinematicBody2D.gd create mode 100644 Pavels/bullet_trajectory/script/Line/Line_Barrel.gd create mode 100644 Pavels/bullet_trajectory/script/Line/Line_Bullet.gd create mode 100644 Pavels/bullet_trajectory/script/Line/Line_Env.gd create mode 100644 Pavels/bullet_trajectory/script/Mob.gd create mode 100644 Pavels/bullet_trajectory/script/Parabola/Parabolic_Barrel.gd create mode 100644 Pavels/bullet_trajectory/script/Parabola/Parabolic_Bullet.gd create mode 100644 Pavels/bullet_trajectory/script/Parabola/Parabolic_Env.gd create mode 100644 Pavels/bullet_trajectory/script/Sine/Sine_Barrel.gd create mode 100644 Pavels/bullet_trajectory/script/Sine/Sine_Bullet.gd create mode 100644 Pavels/bullet_trajectory/script/Sine/Sine_Env.gd diff --git a/Pavels/bullet_trajectory/Bullet.tscn b/Alens/movementSystem0.0.4/Bullet.tscn similarity index 90% rename from Pavels/bullet_trajectory/Bullet.tscn rename to Alens/movementSystem0.0.4/Bullet.tscn index 3519648..93046a8 100644 --- a/Pavels/bullet_trajectory/Bullet.tscn +++ b/Alens/movementSystem0.0.4/Bullet.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=2] [ext_resource path="res://pixil-frame-0 (1).png" type="Texture" id=1] -[ext_resource path="res://Bullet.gd" type="Script" id=2] +[ext_resource path="res://script/Bullet.gd" type="Script" id=2] [sub_resource type="CapsuleShape2D" id=1] radius = 5.4212 diff --git a/Pavels/bullet_trajectory/Env.tscn b/Alens/movementSystem0.0.4/Env.tscn similarity index 80% rename from Pavels/bullet_trajectory/Env.tscn rename to Alens/movementSystem0.0.4/Env.tscn index c037d8f..f28e894 100644 --- a/Pavels/bullet_trajectory/Env.tscn +++ b/Alens/movementSystem0.0.4/Env.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=3 format=2] -[ext_resource path="res://Env.gd" type="Script" id=1] +[ext_resource path="res://script/Env.gd" type="Script" id=1] [ext_resource path="res://Bullet.tscn" type="PackedScene" id=2] [node name="Env" type="Node2D"] diff --git a/Alens/movementSystem0.0.4/Gun.gd b/Alens/movementSystem0.0.4/Gun.gd new file mode 100644 index 0000000..ef22b76 --- /dev/null +++ b/Alens/movementSystem0.0.4/Gun.gd @@ -0,0 +1,26 @@ +extends Position2D + +var rotation_speed = 2 +var rotation_dir = 0 +var time = 0 + +func gun_rotation(): + if Input.is_action_just_pressed("gun_up"): + rotation_dir -= 1 + if Input.is_action_just_pressed("gun_down"): + rotation_dir += 1 + if Input.is_action_just_released("gun_up"): + rotation_dir = 0 + if Input.is_action_just_released("gun_down"): + rotation_dir = 0 + +func _process(delta): + time += delta + #if self.rotation_degrees > -45 and self.rotation_degrees < 15: + #gun_rotation() + #rotation += rotation_speed * rotation_dir * delta + #else: + #gun_rotation() + #rotation += rotation_speed * rotation_dir * delta + look_at(get_global_mouse_position()) + pass diff --git a/Alens/movementSystem0.0.4/Player.tscn b/Alens/movementSystem0.0.4/Player.tscn new file mode 100644 index 0000000..2daf1ef --- /dev/null +++ b/Alens/movementSystem0.0.4/Player.tscn @@ -0,0 +1,19 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://pixilart-drawing.png" type="Texture" id=1] +[ext_resource path="res://script/KinematicBody2D.gd" type="Script" id=2] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 22.279, 10 ) + +[node name="Player" type="KinematicBody2D"] +position = Vector2( 400, 296 ) +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +position = Vector2( 4, -17 ) +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2( 0.381104, 0.412598 ) +shape = SubResource( 1 ) diff --git a/Alens/movementSystem0.0.4/game.tscn b/Alens/movementSystem0.0.4/game.tscn new file mode 100644 index 0000000..3f487ce --- /dev/null +++ b/Alens/movementSystem0.0.4/game.tscn @@ -0,0 +1,38 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://Player.tscn" type="PackedScene" id=1] +[ext_resource path="res://icon.png" type="Texture" id=3] +[ext_resource path="res://script/Gun.gd" type="Script" id=4] +[ext_resource path="res://script/Mob.gd" type="Script" id=5] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 31.7698, 29.9446 ) + +[node name="Node2D" type="Node2D"] + +[node name="Mob" type="KinematicBody2D" parent="." groups=[ +"mobs", +]] +position = Vector2( -0.000213623, 0.000244141 ) +script = ExtResource( 5 ) + +[node name="Sprite" type="Sprite" parent="Mob"] +position = Vector2( 748.393, 296.081 ) +texture = ExtResource( 3 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Mob"] +position = Vector2( 748.393, 293.562 ) +shape = SubResource( 1 ) +one_way_collision_margin = 0.0 + +[node name="Player" parent="." instance=ExtResource( 1 )] + +[node name="Gun" type="Position2D" parent="Player"] +position = Vector2( 37.1728, -6.00076 ) +rotation = -0.507891 +script = ExtResource( 4 ) + +[node name="Sprite" type="Sprite" parent="Player/Gun"] +position = Vector2( 35, 1 ) +scale = Vector2( 1, 0.109375 ) +texture = ExtResource( 3 ) diff --git a/Alens/movementSystem0.0.4/pixil-frame-0 (1).png b/Alens/movementSystem0.0.4/pixil-frame-0 (1).png new file mode 100644 index 0000000000000000000000000000000000000000..ecdddeac28feab66f10c07101cd4acda698c8f6c GIT binary patch literal 29132 zcmeHQX-rgC6rMMXbX1@N#0^14P{E~uaY0341Qaj|R6tP+Jh!4zSyWtDAI7TGNFg{# z-L+V1R6tvbiolC8(b5)Dw4%idjRixIfZzm%W$0nvy(}~RQJb_e&G|u?nfLCw=brPO zbH97uy)!BPzFx*7EJlb#B4ZzK&y^yPB){)ZY6zb+PW-w8{xQ2&dbx{o%Pkv3BDu)N zb8+Cl&{t1>ie9%`=DB#9^_8qlt90e)W#xxWnD*rJQJK{mmF@h(aJRs=7e6LRq%ygJ z6EWg}7k9;Ocb|IN>U;|KwS3I)lnmTQTW)0xR^6WP8+|))gHdqAP|1C_$Uk8DWmUG8 zgL~9A<(Th{^>mSD4>JmGh&`yUjT3uIPlPD>8;+SC@>$e?4pb|{8P56xN*nFOUTQQ= z9WwmB7CcvHNLvobsuUYu-M#3psjk7KWAmTsiQp7#c}|(@HE)n*iAaOY@p>X;-Xq86 zSE{65dKP2(odyFsP_5ADXmmunUa(+#5iyuvFsI{0iW8|0-$C|*lo5G4@^oAr>8!|b zMT(RW%K%t=!P<*%RSGF1QbweVNEwkbB4wlx9_XV8tTJMi5vzegyvX>l23FNR?SgscsE~%3^iRt^V{G=bDpZbYPgm>Cc8PZd}mv|#)jNb8vv(_ z{a&lr3rkJ*JjZNfx7wHsdozomaZy)$toCC5hdftsJtlIBK*E;73F4(yb_)eTEgZ)* zGPB*>NdafyC3vsw)XXK9M=%DDr$6dhK~}W9ox~{k9N+eZu+rtd;qrrD4ieFGLG;|h z<|ge$HV0G+Zw_4{NH&5))W!~ey9GhD6QQBU_QWG(254CT?;BtBY$liI!04)Oc3mM0 z>g2;Pp!XlD7Ymo!uR!#c=nZ7Fad0uNsC}pQVtx>ewqSoVQK@8k?Tf1F`^qp)O={vGY-}=6ba04=-uQaiBz!zlmH1>T#xMV(0o9VKV^1&Y?; zRQ3UoEza~4G-1Sc(6#yG8rrxVx_Y^)WD@Dia`@Q%)U0?<;yYv^J2a&UjRZ;1_6 z0vw)tIo_KpVFpUfR8yx$Ie-#{t&^z|o}k3V-^U9|0DwztYTR5^BMooXcU*$s}l@+@_`b~Lr8 zz{Y1ovzf+*?8J#e&;DQ=Wp(;7t!?7X!6y%o&Sn>#dE`ipSq6jL>2gCm$mB>HmXD21 zH@upY(fNsBA;lV=3yScXtJR=o1=zsPv655mURg@)Z4Y)RYkII$Ylo5)ux`T=i~O^` ze~d8`0&+8a`N1u#r&_D>&ZbW6qGE4Q!>7kxu*UfrEI+N#cDz>Mjwzr|&X}!y?1IZ- z#J0!5`*nLZ314tf1C~_1vHACmz=&;!xh58eSY&Cs+IuQpdOKh4Y3Q;}3hV4{YVRso z=oabR`{kXbueK3iUgVOter>L&t$-duhkBpySUo@@O30hmJQ+vnFtmqymP#mb=n8It}*|BA%Eax*FP!uz2I@i9^e)-Ins_nv#d;x1dyzcgoOGx zS!_qCm5aR?3J~%qr3IGt-!hGd`{!##5T6_r5*n$;oKrZ1#!Y`gwS$=VR>kZu)+5e# zVw0;G7xbBS;4sVJpX*el+%SOc)6#kQzK8UQw*ROoHt0l^9`}#3spS`p(_bv$0H{sT z0|eCwAzC)UASQJ!%t9nKFpbi5i4z%#4V;NdxyEfmCAXA`z(s z4UxB@5-*Q*cZx)&8~T1Dpl>mc%oLgF;Ce7v<89!C5E@iI#*Fk&G7>@vA%ulqoQVm) zmB}%UVj3Ot#9kuB8WGlrbXY3Zh_FUP^CZ@Y2o|tL^v=|X4A}{3e0We(9{fC`$Y+VK JXRbSY;7<{&pymJo literal 0 HcmV?d00001 diff --git a/Alens/movementSystem0.0.4/pixil-frame-0 (1).png.import b/Alens/movementSystem0.0.4/pixil-frame-0 (1).png.import new file mode 100644 index 0000000..553ec28 --- /dev/null +++ b/Alens/movementSystem0.0.4/pixil-frame-0 (1).png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pixil-frame-0 (1).png-160dd9969d7e45d14d604c370b40e019.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://pixil-frame-0 (1).png" +dest_files=[ "res://.import/pixil-frame-0 (1).png-160dd9969d7e45d14d604c370b40e019.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Alens/movementSystem0.0.4/pixilart-drawing.png b/Alens/movementSystem0.0.4/pixilart-drawing.png new file mode 100644 index 0000000000000000000000000000000000000000..a2d76a70f33c57a3d0e20c8c4a1f359ab038888b GIT binary patch literal 818 zcmeAS@N?(olHy`uVBq!ia0vp^DImV0z=};uum9 z_jazMpR}Qb+e3!fVg{`x9x@H8;trPDuUL1zVVt0(Sko)piyMR3@wOpG%~?6Y{KT%0(i>b4tnFF- z`*pL`&(ELB&Fi~O&&OqV7v#53yLi!(O*36prSqr$(xbc5w=QutNODd)c&g%Z(!6f{ z34%e2k`totJuq;x+4L{d-6pj+?~SfsoBo$af0wRpQe5(5%GTZPo9tw!Rk+AC+~4jU zo$FNMTy)5nD_W`Z-wbOu=exQ`Dl zbJJyU=gUQWN0(MP7oAIpH&!UvFn2-gUltLj+mc*?96by=eY`|ajhsKZuQ literal 0 HcmV?d00001 diff --git a/Alens/movementSystem0.0.4/pixilart-drawing.png.import b/Alens/movementSystem0.0.4/pixilart-drawing.png.import new file mode 100644 index 0000000..187733d --- /dev/null +++ b/Alens/movementSystem0.0.4/pixilart-drawing.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pixilart-drawing.png-9e9c431ac86a42d1fefc4da3ac6bc15c.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://pixilart-drawing.png" +dest_files=[ "res://.import/pixilart-drawing.png-9e9c431ac86a42d1fefc4da3ac6bc15c.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/Pavels/bullet_trajectory/Bullet.gd b/Alens/movementSystem0.0.4/script/Bullet.gd similarity index 55% rename from Pavels/bullet_trajectory/Bullet.gd rename to Alens/movementSystem0.0.4/script/Bullet.gd index 04f9c92..0c67cac 100644 --- a/Pavels/bullet_trajectory/Bullet.gd +++ b/Alens/movementSystem0.0.4/script/Bullet.gd @@ -12,51 +12,33 @@ var gravitile = 5 func follow_line_trajectory(): velocity = Vector2(1, 0) #Vector2(cos(self.global_rotation), sin(self.global_rotation)) - pass + return velocity func follow_sine_trajectory(): velocity.y = amplitude * cos(time * frequency) velocity.x = 5 - pass + return velocity func follow_parabolic_trajectory(): velocity.x = 5 velocity.y = 1 * time * gravitile - - -func follow_n_parabolic_trajectory(): - velocity.x = 5 - velocity.y = -1 * time * gravitile - + return velocity func follow_hyperbolic_trajectory(): velocity.x = gravitile * time velocity.y = 1 + return velocity -func follow_n_hyperbolic_trajectory(): - velocity.x = gravitile * time - velocity.y = -1 - - -func chosen_trajectory(): +func input(): if Input.is_action_just_pressed("line"): - follow_line_trajectory() - elif Input.is_action_just_pressed("parab"): - follow_parabolic_trajectory() - elif Input.is_action_just_pressed("n_parab"): - follow_n_parabolic_trajectory() - elif Input.is_action_just_pressed("hyper"): - follow_hyperbolic_trajectory() - elif Input.is_action_just_pressed("n_hyper"): - follow_n_hyperbolic_trajectory() + return follow_sine_trajectory() elif Input.is_action_just_pressed("sine"): - follow_sine_trajectory() + return follow_line_trajectory() else: - follow_line_trajectory() - + print('Trajectory is not selected') + queue_free() func _process(delta): - follow_sine_trajectory() time += delta position += velocity * speed * delta diff --git a/Pavels/bullet_trajectory/Env.gd b/Alens/movementSystem0.0.4/script/Env.gd similarity index 70% rename from Pavels/bullet_trajectory/Env.gd rename to Alens/movementSystem0.0.4/script/Env.gd index 1d470f0..9aa538e 100644 --- a/Pavels/bullet_trajectory/Env.gd +++ b/Alens/movementSystem0.0.4/script/Env.gd @@ -3,11 +3,8 @@ extends Node2D onready var bullet = preload("res://Bullet.tscn") var time = 0 - -func trigger(): - var b = bullet.instance() - add_child(b) - +func _draw(): + draw_line(Vector2(0, 0), Vector2(1000, 0), 1) func _process(delta): time += delta diff --git a/Alens/movementSystem0.0.4/script/Gun.gd b/Alens/movementSystem0.0.4/script/Gun.gd new file mode 100644 index 0000000..ef22b76 --- /dev/null +++ b/Alens/movementSystem0.0.4/script/Gun.gd @@ -0,0 +1,26 @@ +extends Position2D + +var rotation_speed = 2 +var rotation_dir = 0 +var time = 0 + +func gun_rotation(): + if Input.is_action_just_pressed("gun_up"): + rotation_dir -= 1 + if Input.is_action_just_pressed("gun_down"): + rotation_dir += 1 + if Input.is_action_just_released("gun_up"): + rotation_dir = 0 + if Input.is_action_just_released("gun_down"): + rotation_dir = 0 + +func _process(delta): + time += delta + #if self.rotation_degrees > -45 and self.rotation_degrees < 15: + #gun_rotation() + #rotation += rotation_speed * rotation_dir * delta + #else: + #gun_rotation() + #rotation += rotation_speed * rotation_dir * delta + look_at(get_global_mouse_position()) + pass diff --git a/Pavels/bullet_trajectory/KinematicBody2D.gd b/Alens/movementSystem0.0.4/script/KinematicBody2D.gd similarity index 93% rename from Pavels/bullet_trajectory/KinematicBody2D.gd rename to Alens/movementSystem0.0.4/script/KinematicBody2D.gd index 3f902fe..1ee89ea 100644 --- a/Pavels/bullet_trajectory/KinematicBody2D.gd +++ b/Alens/movementSystem0.0.4/script/KinematicBody2D.gd @@ -19,7 +19,7 @@ func get_input(): movement.y += 10 if Input.is_action_pressed("ui_up"): movement.y -= 10 - if Input.is_action_pressed("shoot"): + if Input.is_action_just_pressed("shoot"): shoot() func _physics_process(delta): diff --git a/Pavels/bullet_trajectory/Mob.gd b/Alens/movementSystem0.0.4/script/Mob.gd similarity index 100% rename from Pavels/bullet_trajectory/Mob.gd rename to Alens/movementSystem0.0.4/script/Mob.gd diff --git a/Alens/movementSystem0.0.4/source/levels/trinity_site/trinity-site-level.tscn b/Alens/movementSystem0.0.4/source/levels/trinity_site/trinity-site-level.tscn index aef5f3d..9bf30ec 100644 --- a/Alens/movementSystem0.0.4/source/levels/trinity_site/trinity-site-level.tscn +++ b/Alens/movementSystem0.0.4/source/levels/trinity_site/trinity-site-level.tscn @@ -1,12 +1,23 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://source/entities/player/player-node.tscn" type="PackedScene" id=1] [ext_resource path="res://source/levels/trinity_site/images/trinity_site_level_layout-monochrome.png" type="Texture" id=2] +[ext_resource path="res://script/Gun.gd" type="Script" id=3] +[ext_resource path="res://icon.png" type="Texture" id=4] [node name="trinity-site" type="Node2D"] [node name="player-node" parent="." instance=ExtResource( 1 )] -position = Vector2( 212.292, 277.24 ) +position = Vector2( 183.338, 269.222 ) + +[node name="Barrel" type="Position2D" parent="player-node"] +position = Vector2( -10.2453, -2.6727 ) +script = ExtResource( 3 ) + +[node name="Sprite" type="Sprite" parent="player-node/Barrel"] +position = Vector2( -26.9819, -0.589844 ) +scale = Vector2( 0.0818972, 0.0127678 ) +texture = ExtResource( 4 ) [node name="trinity-site-body" type="StaticBody2D" parent="."] diff --git a/Pavels/bullet_trajectory/Gun.gd b/Pavels/bullet_trajectory/Gun.gd deleted file mode 100644 index 727d10a..0000000 --- a/Pavels/bullet_trajectory/Gun.gd +++ /dev/null @@ -1,4 +0,0 @@ -extends Position2D - -func _process(delta): - look_at(get_global_mouse_position()) diff --git a/Pavels/bullet_trajectory/Hyperbolic_Trajectory/Hyperbolic_Barrel.tscn b/Pavels/bullet_trajectory/Hyperbolic_Trajectory/Hyperbolic_Barrel.tscn new file mode 100644 index 0000000..9e1a160 --- /dev/null +++ b/Pavels/bullet_trajectory/Hyperbolic_Trajectory/Hyperbolic_Barrel.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://icon.png" type="Texture" id=1] +[ext_resource path="res://script/Hyperbola/Hyperbolic_Barrel.gd" type="Script" id=2] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 22.5946, 3.60519 ) + +[node name="Hyperbolic_Barrel" type="StaticBody2D"] +script = ExtResource( 2 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2( 30.4661, 0.749161 ) +shape = SubResource( 1 ) + +[node name="icon" type="Sprite" parent="."] +position = Vector2( 42.4007, 0.196289 ) +scale = Vector2( 1.31624, 0.140625 ) +texture = ExtResource( 1 ) + +[node name="Position2D" type="Position2D" parent="."] +position = Vector2( 97.6552, 0.0842819 ) diff --git a/Pavels/bullet_trajectory/Hyperbolic_Trajectory/Hyperbolic_Bullet.tscn b/Pavels/bullet_trajectory/Hyperbolic_Trajectory/Hyperbolic_Bullet.tscn new file mode 100644 index 0000000..cd9ffd6 --- /dev/null +++ b/Pavels/bullet_trajectory/Hyperbolic_Trajectory/Hyperbolic_Bullet.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://pixil-frame-0 (1).png" type="Texture" id=1] +[ext_resource path="res://script/Hyperbola/Hyperbolic_Bullet.gd" type="Script" id=2] + +[sub_resource type="CapsuleShape2D" id=1] +radius = 5.4212 +height = 7.62897 + +[node name="Bullet" type="Area2D"] +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +position = Vector2( 2, -19 ) +scale = Vector2( 0.199834, 0.199834 ) +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +rotation = 1.5708 +shape = SubResource( 1 ) + +[connection signal="body_entered" from="." to="." method="_on_Bullet_body_entered"] diff --git a/Pavels/bullet_trajectory/Hyperbolic_Trajectory/Hyperbolic_Env.tscn b/Pavels/bullet_trajectory/Hyperbolic_Trajectory/Hyperbolic_Env.tscn new file mode 100644 index 0000000..6dd98e1 --- /dev/null +++ b/Pavels/bullet_trajectory/Hyperbolic_Trajectory/Hyperbolic_Env.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://Line_Trajectory/Line_Bullet.tscn" type="PackedScene" id=1] +[ext_resource path="res://script/Hyperbola/Hyperbolic_Env.gd" type="Script" id=2] +[ext_resource path="res://script/Hyperbola/Hyperbolic_Bullet.gd" type="Script" id=3] + +[node name="Env" type="Node2D"] +script = ExtResource( 2 ) + +[node name="Bullet" parent="." instance=ExtResource( 1 )] +position = Vector2( 0, -0.222725 ) +script = ExtResource( 3 ) diff --git a/Pavels/bullet_trajectory/Line_Trajectory/Line_Barrel.tscn b/Pavels/bullet_trajectory/Line_Trajectory/Line_Barrel.tscn new file mode 100644 index 0000000..1b2e3c9 --- /dev/null +++ b/Pavels/bullet_trajectory/Line_Trajectory/Line_Barrel.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://icon.png" type="Texture" id=1] +[ext_resource path="res://script/Line/Line_Barrel.gd" type="Script" id=2] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 22.5946, 3.60519 ) + +[node name="Line_Barrel" type="StaticBody2D"] +script = ExtResource( 2 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2( 30.4661, 0.749161 ) +shape = SubResource( 1 ) + +[node name="icon" type="Sprite" parent="."] +position = Vector2( 32.281, 0.196289 ) +scale = Vector2( 1, 0.140625 ) +texture = ExtResource( 1 ) + +[node name="Position2D" type="Position2D" parent="."] +position = Vector2( 64.7166, 0.0842819 ) diff --git a/Pavels/bullet_trajectory/Line_Trajectory/Line_Bullet.tscn b/Pavels/bullet_trajectory/Line_Trajectory/Line_Bullet.tscn new file mode 100644 index 0000000..b342e67 --- /dev/null +++ b/Pavels/bullet_trajectory/Line_Trajectory/Line_Bullet.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://pixil-frame-0 (1).png" type="Texture" id=1] +[ext_resource path="res://script/Line/Line_Bullet.gd" type="Script" id=2] + +[sub_resource type="CapsuleShape2D" id=1] +radius = 5.4212 +height = 7.62897 + +[node name="Bullet" type="Area2D"] +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +position = Vector2( 2, -19 ) +scale = Vector2( 0.199834, 0.199834 ) +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +rotation = 1.5708 +shape = SubResource( 1 ) + +[connection signal="body_entered" from="." to="." method="_on_Bullet_body_entered"] diff --git a/Pavels/bullet_trajectory/Line_Trajectory/Line_Env.tscn b/Pavels/bullet_trajectory/Line_Trajectory/Line_Env.tscn new file mode 100644 index 0000000..0640b7e --- /dev/null +++ b/Pavels/bullet_trajectory/Line_Trajectory/Line_Env.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://Line_Trajectory/Line_Bullet.tscn" type="PackedScene" id=1] +[ext_resource path="res://script/Line/Line_Env.gd" type="Script" id=2] + +[node name="Env" type="Node2D"] +script = ExtResource( 2 ) + +[node name="Bullet" parent="." instance=ExtResource( 1 )] +position = Vector2( 0, -0.222725 ) diff --git a/Pavels/bullet_trajectory/Parabolic_Trajectory/Parabolic_Barrel.tscn b/Pavels/bullet_trajectory/Parabolic_Trajectory/Parabolic_Barrel.tscn new file mode 100644 index 0000000..d7e228d --- /dev/null +++ b/Pavels/bullet_trajectory/Parabolic_Trajectory/Parabolic_Barrel.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://icon.png" type="Texture" id=1] +[ext_resource path="res://script/Parabola/Parabolic_Barrel.gd" type="Script" id=2] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 8.79762, 3.60519 ) + +[node name="Parabolic_Barrel" type="StaticBody2D"] +script = ExtResource( 2 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2( 13.539, 2.08551 ) +shape = SubResource( 1 ) + +[node name="icon" type="Sprite" parent="."] +position = Vector2( 16.2448, 0.641744 ) +scale = Vector2( 0.387507, 0.251987 ) +texture = ExtResource( 1 ) + +[node name="Position2D" type="Position2D" parent="."] +position = Vector2( 34.426, 0.975182 ) diff --git a/Pavels/bullet_trajectory/Parabolic_Trajectory/Parabolic_Bullet.tscn b/Pavels/bullet_trajectory/Parabolic_Trajectory/Parabolic_Bullet.tscn new file mode 100644 index 0000000..b342e67 --- /dev/null +++ b/Pavels/bullet_trajectory/Parabolic_Trajectory/Parabolic_Bullet.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://pixil-frame-0 (1).png" type="Texture" id=1] +[ext_resource path="res://script/Line/Line_Bullet.gd" type="Script" id=2] + +[sub_resource type="CapsuleShape2D" id=1] +radius = 5.4212 +height = 7.62897 + +[node name="Bullet" type="Area2D"] +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +position = Vector2( 2, -19 ) +scale = Vector2( 0.199834, 0.199834 ) +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +rotation = 1.5708 +shape = SubResource( 1 ) + +[connection signal="body_entered" from="." to="." method="_on_Bullet_body_entered"] diff --git a/Pavels/bullet_trajectory/Parabolic_Trajectory/Parabolic_Env.tscn b/Pavels/bullet_trajectory/Parabolic_Trajectory/Parabolic_Env.tscn new file mode 100644 index 0000000..07cfd7f --- /dev/null +++ b/Pavels/bullet_trajectory/Parabolic_Trajectory/Parabolic_Env.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://Line_Trajectory/Line_Bullet.tscn" type="PackedScene" id=1] +[ext_resource path="res://script/Parabola/Parabolic_Env.gd" type="Script" id=2] +[ext_resource path="res://script/Parabola/Parabolic_Bullet.gd" type="Script" id=3] + +[node name="Env" type="Node2D"] +script = ExtResource( 2 ) + +[node name="Bullet" parent="." instance=ExtResource( 1 )] +position = Vector2( 0, -0.222725 ) +script = ExtResource( 3 ) diff --git a/Pavels/bullet_trajectory/Player.tscn b/Pavels/bullet_trajectory/Player.tscn index 2d46f1a..2daf1ef 100644 --- a/Pavels/bullet_trajectory/Player.tscn +++ b/Pavels/bullet_trajectory/Player.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=4 format=2] [ext_resource path="res://pixilart-drawing.png" type="Texture" id=1] -[ext_resource path="res://KinematicBody2D.gd" type="Script" id=2] +[ext_resource path="res://script/KinematicBody2D.gd" type="Script" id=2] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 22.279, 10 ) diff --git a/Pavels/bullet_trajectory/Sine_Trajectory/Sine_Barrel.tscn b/Pavels/bullet_trajectory/Sine_Trajectory/Sine_Barrel.tscn new file mode 100644 index 0000000..690b1ca --- /dev/null +++ b/Pavels/bullet_trajectory/Sine_Trajectory/Sine_Barrel.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://icon.png" type="Texture" id=1] +[ext_resource path="res://script/Sine/Sine_Barrel.gd" type="Script" id=2] + +[sub_resource type="RectangleShape2D" id=1] +extents = Vector2( 21.0351, 6.99966 ) + +[node name="Sine_Barrel" type="StaticBody2D"] +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +position = Vector2( 32.0917, 0.471939 ) +scale = Vector2( 1, 0.336339 ) +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2( 30.8681, 0 ) +shape = SubResource( 1 ) + +[node name="Position2D" type="Position2D" parent="."] +position = Vector2( 64.7166, 0.0842819 ) diff --git a/Pavels/bullet_trajectory/Sine_Trajectory/Sine_Bullet.tscn b/Pavels/bullet_trajectory/Sine_Trajectory/Sine_Bullet.tscn new file mode 100644 index 0000000..b342e67 --- /dev/null +++ b/Pavels/bullet_trajectory/Sine_Trajectory/Sine_Bullet.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://pixil-frame-0 (1).png" type="Texture" id=1] +[ext_resource path="res://script/Line/Line_Bullet.gd" type="Script" id=2] + +[sub_resource type="CapsuleShape2D" id=1] +radius = 5.4212 +height = 7.62897 + +[node name="Bullet" type="Area2D"] +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +position = Vector2( 2, -19 ) +scale = Vector2( 0.199834, 0.199834 ) +texture = ExtResource( 1 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +rotation = 1.5708 +shape = SubResource( 1 ) + +[connection signal="body_entered" from="." to="." method="_on_Bullet_body_entered"] diff --git a/Pavels/bullet_trajectory/Sine_Trajectory/Sine_Env.tscn b/Pavels/bullet_trajectory/Sine_Trajectory/Sine_Env.tscn new file mode 100644 index 0000000..f0c77d5 --- /dev/null +++ b/Pavels/bullet_trajectory/Sine_Trajectory/Sine_Env.tscn @@ -0,0 +1,12 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://Line_Trajectory/Line_Bullet.tscn" type="PackedScene" id=1] +[ext_resource path="res://script/Sine/Sine_Env.gd" type="Script" id=2] +[ext_resource path="res://script/Sine/Sine_Bullet.gd" type="Script" id=3] + +[node name="Env" type="Node2D"] +script = ExtResource( 2 ) + +[node name="Bullet" parent="." instance=ExtResource( 1 )] +position = Vector2( 0, -0.222725 ) +script = ExtResource( 3 ) diff --git a/Pavels/bullet_trajectory/game.tscn b/Pavels/bullet_trajectory/game.tscn index 025f87f..109ab9e 100644 --- a/Pavels/bullet_trajectory/game.tscn +++ b/Pavels/bullet_trajectory/game.tscn @@ -2,8 +2,8 @@ [ext_resource path="res://Player.tscn" type="PackedScene" id=1] [ext_resource path="res://icon.png" type="Texture" id=3] -[ext_resource path="res://Gun.gd" type="Script" id=4] -[ext_resource path="res://Mob.gd" type="Script" id=5] +[ext_resource path="res://script/Gun.gd" type="Script" id=4] +[ext_resource path="res://script/Mob.gd" type="Script" id=5] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 31.7698, 29.9446 ) @@ -27,11 +27,6 @@ one_way_collision_margin = 0.0 [node name="Player" parent="." instance=ExtResource( 1 )] -[node name="Gun" type="Position2D" parent="Player"] +[node name="Gun_Position" type="Position2D" parent="Player"] position = Vector2( 37.1728, -6.00076 ) script = ExtResource( 4 ) - -[node name="Sprite" type="Sprite" parent="Player/Gun"] -position = Vector2( 35, 1 ) -scale = Vector2( 1, 0.109375 ) -texture = ExtResource( 3 ) diff --git a/Pavels/bullet_trajectory/project.godot b/Pavels/bullet_trajectory/project.godot index 47baf24..671b2cb 100644 --- a/Pavels/bullet_trajectory/project.godot +++ b/Pavels/bullet_trajectory/project.godot @@ -65,24 +65,14 @@ parab={ "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":16777352,"unicode":0,"echo":false,"script":null) ] } -n_parab={ -"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":16777353,"unicode":0,"echo":false,"script":null) - ] -} hyper={ "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":16777354,"unicode":0,"echo":false,"script":null) ] } -n_hyper={ -"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":16777355,"unicode":0,"echo":false,"script":null) - ] -} sine={ "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":16777356,"unicode":0,"echo":false,"script":null) +"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":16777353,"unicode":0,"echo":false,"script":null) ] } diff --git a/Pavels/bullet_trajectory/script/Gun.gd b/Pavels/bullet_trajectory/script/Gun.gd new file mode 100644 index 0000000..88a20a3 --- /dev/null +++ b/Pavels/bullet_trajectory/script/Gun.gd @@ -0,0 +1,30 @@ +extends Position2D + +var trajectories = { + 'line' : preload("res://Line_Trajectory/Line_Barrel.tscn"), + 'sine' : preload("res://Sine_Trajectory/Sine_Barrel.tscn"), + 'parab' : preload("res://Parabolic_Trajectory/Parabolic_Barrel.tscn"), + 'hyper' : preload("res://Hyperbolic_Trajectory/Hyperbolic_Barrel.tscn") +} + + +func equip_gun(gun_type:String): + for gun in get_children(): #if there is gun remove it + gun.queue_free() + + var gun = trajectories[gun_type].instance() + add_child(gun) + + + +func _process(delta): + look_at(get_global_mouse_position()) + if Input.is_action_just_pressed("line"): + equip_gun('line') + if Input.is_action_just_pressed("sine"): + equip_gun('sine') + if Input.is_action_just_pressed("parab"): + equip_gun('parab') + if Input.is_action_just_pressed("hyper"): + equip_gun('hyper') + pass diff --git a/Pavels/bullet_trajectory/script/Hyperbola/Hyperbolic_Barrel.gd b/Pavels/bullet_trajectory/script/Hyperbola/Hyperbolic_Barrel.gd new file mode 100644 index 0000000..fc808d6 --- /dev/null +++ b/Pavels/bullet_trajectory/script/Hyperbola/Hyperbolic_Barrel.gd @@ -0,0 +1,16 @@ +extends StaticBody2D # Y = aX + +onready var bullet = preload("res://Hyperbolic_Trajectory/Hyperbolic_Env.tscn") + + +func shoot(): + var b = bullet.instance() + get_parent().get_parent().get_parent().add_child(b) + b.global_position = $Position2D.global_position + b.global_rotation = $Position2D.global_rotation + + + +func _process(delta): + if Input.is_action_just_pressed("shoot"): + shoot() diff --git a/Pavels/bullet_trajectory/script/Hyperbola/Hyperbolic_Bullet.gd b/Pavels/bullet_trajectory/script/Hyperbola/Hyperbolic_Bullet.gd new file mode 100644 index 0000000..69f7b2e --- /dev/null +++ b/Pavels/bullet_trajectory/script/Hyperbola/Hyperbolic_Bullet.gd @@ -0,0 +1,24 @@ +extends Area2D + +var velocity = Vector2() +var speed = 1 +var time = 0.5 +var gravitile = 5 + + + +func follow_hyperbolic_trajectory(): + velocity.x = gravitile * time + velocity.y = 1/time + + +func _process(delta): + follow_hyperbolic_trajectory() + time += delta + position += velocity * speed * delta + + +func _on_Bullet_body_entered(body): + if body.is_in_group("mobs"): + body.queue_free() + queue_free() diff --git a/Pavels/bullet_trajectory/script/Hyperbola/Hyperbolic_Env.gd b/Pavels/bullet_trajectory/script/Hyperbola/Hyperbolic_Env.gd new file mode 100644 index 0000000..344a757 --- /dev/null +++ b/Pavels/bullet_trajectory/script/Hyperbola/Hyperbolic_Env.gd @@ -0,0 +1,10 @@ +extends Node2D + + +var time = 0 + + +func _process(delta): + time += delta + if time > 17: + queue_free() diff --git a/Pavels/bullet_trajectory/script/KinematicBody2D.gd b/Pavels/bullet_trajectory/script/KinematicBody2D.gd new file mode 100644 index 0000000..1aa9367 --- /dev/null +++ b/Pavels/bullet_trajectory/script/KinematicBody2D.gd @@ -0,0 +1,26 @@ +extends KinematicBody2D + +export var speed = 400 +var movement = Vector2(0, 0) + +#func shoot(): + #var b = env.instance() + #get_parent().add_child(b) + #b.global_transform = $Gun.global_transform + +func get_input(): + movement = Vector2() + if Input.is_action_pressed("ui_right"): + movement.x += 10 + if Input.is_action_pressed("ui_left"): + movement.x -= 10 + if Input.is_action_pressed("ui_down"): + movement.y += 10 + if Input.is_action_pressed("ui_up"): + movement.y -= 10 + #if Input.is_action_just_pressed("shoot"): + #shoot() + +func _physics_process(delta): + get_input() + position += movement.normalized() * speed * delta diff --git a/Pavels/bullet_trajectory/script/Line/Line_Barrel.gd b/Pavels/bullet_trajectory/script/Line/Line_Barrel.gd new file mode 100644 index 0000000..4ba9307 --- /dev/null +++ b/Pavels/bullet_trajectory/script/Line/Line_Barrel.gd @@ -0,0 +1,16 @@ +extends StaticBody2D # Y = aX + +onready var bullet = preload("res://Line_Trajectory/Line_Env.tscn") + + +func shoot(): + var b = bullet.instance() + get_parent().get_parent().get_parent().add_child(b) + b.global_position = $Position2D.global_position + b.global_rotation = $Position2D.global_rotation + + + +func _process(delta): + if Input.is_action_just_pressed("shoot"): + shoot() diff --git a/Pavels/bullet_trajectory/script/Line/Line_Bullet.gd b/Pavels/bullet_trajectory/script/Line/Line_Bullet.gd new file mode 100644 index 0000000..3c958c0 --- /dev/null +++ b/Pavels/bullet_trajectory/script/Line/Line_Bullet.gd @@ -0,0 +1,43 @@ +extends Area2D + +export var speed = 100 +var velocity = Vector2() + +var time = 0 +export var amplitude = 4 +export var frequency = 5 +var gravitile = 5 + + +func follow_line_trajectory(): + velocity = Vector2(10, 0) + +#func follow_parabolic_trajectory(): + #velocity.x = 5 + #velocity.y = 1 * time * gravitile + #return velocity + +#func follow_hyperbolic_trajectory(): + #velocity.x = gravitile * time + #velocity.y = 1 + #return velocity + +#func input(): + #if Input.is_action_just_pressed("line"): + #return follow_sine_trajectory() + #elif Input.is_action_just_pressed("sine"): + #return follow_line_trajectory() + #else: + #print('Trajectory is not selected') + #queue_free() + +func _process(delta): + follow_line_trajectory() + time += delta + position += velocity * speed * delta + + +func _on_Bullet_body_entered(body): + if body.is_in_group("mobs"): + body.queue_free() + queue_free() diff --git a/Pavels/bullet_trajectory/script/Line/Line_Env.gd b/Pavels/bullet_trajectory/script/Line/Line_Env.gd new file mode 100644 index 0000000..3a7645d --- /dev/null +++ b/Pavels/bullet_trajectory/script/Line/Line_Env.gd @@ -0,0 +1,9 @@ +extends Node2D + +var time = 0 + + +func _process(delta): + time += delta + if time > 17: + queue_free() diff --git a/Pavels/bullet_trajectory/script/Mob.gd b/Pavels/bullet_trajectory/script/Mob.gd new file mode 100644 index 0000000..16a9985 --- /dev/null +++ b/Pavels/bullet_trajectory/script/Mob.gd @@ -0,0 +1,10 @@ +extends KinematicBody2D + + +var velocity = Vector2(1, 1) + +func _process(delta): + var collision = move_and_collide(velocity * delta) + + + diff --git a/Pavels/bullet_trajectory/script/Parabola/Parabolic_Barrel.gd b/Pavels/bullet_trajectory/script/Parabola/Parabolic_Barrel.gd new file mode 100644 index 0000000..d020184 --- /dev/null +++ b/Pavels/bullet_trajectory/script/Parabola/Parabolic_Barrel.gd @@ -0,0 +1,16 @@ +extends StaticBody2D # Y = aX + +onready var bullet = preload("res://Parabolic_Trajectory/Parabolic_Env.tscn") + + +func shoot(): + var b = bullet.instance() + get_parent().get_parent().get_parent().add_child(b) + b.global_position = $Position2D.global_position + b.global_rotation = $Position2D.global_rotation + + + +func _process(delta): + if Input.is_action_just_pressed("shoot"): + shoot() diff --git a/Pavels/bullet_trajectory/script/Parabola/Parabolic_Bullet.gd b/Pavels/bullet_trajectory/script/Parabola/Parabolic_Bullet.gd new file mode 100644 index 0000000..beee2de --- /dev/null +++ b/Pavels/bullet_trajectory/script/Parabola/Parabolic_Bullet.gd @@ -0,0 +1,24 @@ +extends Area2D + +export var speed = 100 +var velocity = Vector2() + +var time = 0 +var gravitile = 5 + + +func follow_parabolic_trajectory(): + velocity.x = 5 + velocity.y = 1 * time * gravitile + + +func _process(delta): + follow_parabolic_trajectory() + time += delta + position += velocity * speed * delta + + +func _on_Bullet_body_entered(body): + if body.is_in_group("mobs"): + body.queue_free() + queue_free() diff --git a/Pavels/bullet_trajectory/script/Parabola/Parabolic_Env.gd b/Pavels/bullet_trajectory/script/Parabola/Parabolic_Env.gd new file mode 100644 index 0000000..3a7645d --- /dev/null +++ b/Pavels/bullet_trajectory/script/Parabola/Parabolic_Env.gd @@ -0,0 +1,9 @@ +extends Node2D + +var time = 0 + + +func _process(delta): + time += delta + if time > 17: + queue_free() diff --git a/Pavels/bullet_trajectory/script/Sine/Sine_Barrel.gd b/Pavels/bullet_trajectory/script/Sine/Sine_Barrel.gd new file mode 100644 index 0000000..79ce4e8 --- /dev/null +++ b/Pavels/bullet_trajectory/script/Sine/Sine_Barrel.gd @@ -0,0 +1,20 @@ +extends StaticBody2D + +onready var bullet = preload("res://Sine_Trajectory/Sine_Env.tscn") + +var velocity = Vector2(1, 0) +var shooting_speed = 200 + + + +func shoot(): + var b = bullet.instance() + get_parent().get_parent().get_parent().add_child(b) + b.global_position = $Position2D.global_position + b.global_rotation = $Position2D.global_rotation + pass + + +func _process(delta): + if Input.is_action_just_pressed("shoot"): + shoot() diff --git a/Pavels/bullet_trajectory/script/Sine/Sine_Bullet.gd b/Pavels/bullet_trajectory/script/Sine/Sine_Bullet.gd new file mode 100644 index 0000000..1196b54 --- /dev/null +++ b/Pavels/bullet_trajectory/script/Sine/Sine_Bullet.gd @@ -0,0 +1,25 @@ +extends Area2D + +export var speed = 100 +var velocity = Vector2() + +var time = 0 +export var amplitude = 4 +export var frequency = 5 +var gravitile = 5 + + +func follow_sine_trajectory(): + velocity.y = amplitude * cos(time * frequency) + velocity.x = 5 + +func _process(delta): + follow_sine_trajectory() + time += delta + position += velocity * speed * delta + + +func _on_Bullet_body_entered(body): + if body.is_in_group("mobs"): + body.queue_free() + queue_free() diff --git a/Pavels/bullet_trajectory/script/Sine/Sine_Env.gd b/Pavels/bullet_trajectory/script/Sine/Sine_Env.gd new file mode 100644 index 0000000..3a7645d --- /dev/null +++ b/Pavels/bullet_trajectory/script/Sine/Sine_Env.gd @@ -0,0 +1,9 @@ +extends Node2D + +var time = 0 + + +func _process(delta): + time += delta + if time > 17: + queue_free() diff --git a/kristofers/game/.import/floor.svg-297905206d682966af5dba035b7d5368.md5 b/kristofers/game/.import/floor.svg-297905206d682966af5dba035b7d5368.md5 index 61691d3..2302b2d 100644 --- a/kristofers/game/.import/floor.svg-297905206d682966af5dba035b7d5368.md5 +++ b/kristofers/game/.import/floor.svg-297905206d682966af5dba035b7d5368.md5 @@ -1,3 +1,3 @@ -source_md5="ea99925cae38c148dc6a1c29df4fb92e" +source_md5="1ef07a57f4eef86ceba35b7c02cb78b5" dest_md5="f73af61b19494ec5bf488ba2a748b42b" diff --git a/kristofers/game/.import/square.svg-eb5ce7ff66dca983c1acbf7134c96e32.md5 b/kristofers/game/.import/square.svg-eb5ce7ff66dca983c1acbf7134c96e32.md5 index 5d07b18..660225f 100644 --- a/kristofers/game/.import/square.svg-eb5ce7ff66dca983c1acbf7134c96e32.md5 +++ b/kristofers/game/.import/square.svg-eb5ce7ff66dca983c1acbf7134c96e32.md5 @@ -1,3 +1,3 @@ -source_md5="8fad288d82d0e9d24f41f65f4d5e4301" +source_md5="64335dc88c42b14614e00f82df952f3e" dest_md5="a9d8bb2f96bc788ab0d7fc16f125c927" diff --git a/kristofers/movementSystem0.0.3/.import/floor.svg-297905206d682966af5dba035b7d5368.md5 b/kristofers/movementSystem0.0.3/.import/floor.svg-297905206d682966af5dba035b7d5368.md5 index 61691d3..2302b2d 100644 --- a/kristofers/movementSystem0.0.3/.import/floor.svg-297905206d682966af5dba035b7d5368.md5 +++ b/kristofers/movementSystem0.0.3/.import/floor.svg-297905206d682966af5dba035b7d5368.md5 @@ -1,3 +1,3 @@ -source_md5="ea99925cae38c148dc6a1c29df4fb92e" +source_md5="1ef07a57f4eef86ceba35b7c02cb78b5" dest_md5="f73af61b19494ec5bf488ba2a748b42b" diff --git a/kristofers/movementSystem0.0.3/.import/square.svg-eb5ce7ff66dca983c1acbf7134c96e32.md5 b/kristofers/movementSystem0.0.3/.import/square.svg-eb5ce7ff66dca983c1acbf7134c96e32.md5 index 5d07b18..660225f 100644 --- a/kristofers/movementSystem0.0.3/.import/square.svg-eb5ce7ff66dca983c1acbf7134c96e32.md5 +++ b/kristofers/movementSystem0.0.3/.import/square.svg-eb5ce7ff66dca983c1acbf7134c96e32.md5 @@ -1,3 +1,3 @@ -source_md5="8fad288d82d0e9d24f41f65f4d5e4301" +source_md5="64335dc88c42b14614e00f82df952f3e" dest_md5="a9d8bb2f96bc788ab0d7fc16f125c927"