From aa734b04ee705ca36c83c3de20a49297691cf1ea Mon Sep 17 00:00:00 2001 From: MrPixel92 <35262174+MrPixel92@users.noreply.github.com> Date: Sat, 29 Apr 2023 13:57:47 +0300 Subject: [PATCH 1/7] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B3=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=D0=B8=D0=BB=20=D0=BF=D1=83=D1=88=D0=BA=D0=B8=20=D0=BA=20?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=BE=D0=B9=20=D1=81=D0=B8=D1=81=D1=82=D0=B5?= =?UTF-8?q?=D0=BC=D0=B5=20=D1=81=D1=82=D1=80=D0=B5=D0=BB=D1=8C=D0=B1=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Добавил скорострельность и авто/одиноч выстрелы --- Applications/RayWalk.app/Weapons/Weapons.cfg | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Applications/RayWalk.app/Weapons/Weapons.cfg b/Applications/RayWalk.app/Weapons/Weapons.cfg index f7aa4274..ffb0f067 100755 --- a/Applications/RayWalk.app/Weapons/Weapons.cfg +++ b/Applications/RayWalk.app/Weapons/Weapons.cfg @@ -8,6 +8,8 @@ x = -1, y = -4, }, + fireTime = 3, + isAuto = 0, crosshairTexture = "CrosshairTextures/Default.pic", }, { @@ -19,6 +21,8 @@ x = 1, y = -1, }, + fireTime = 2, + isAuto = 1, crosshairTexture = "CrosshairTextures/Half.pic", }, { @@ -31,6 +35,8 @@ y = 1, }, crosshairTexture = "CrosshairTextures/Angled.pic", + fireTime = 5, + isAuto = 0, }, { name = "Plasmer", @@ -41,6 +47,8 @@ x = 1, y = -2, }, + fireTime = 3, + isAuto = 1, crosshairTexture = "CrosshairTextures/Dotted.pic", }, -} \ No newline at end of file +} From 37834ce2b0c8f7b247b2a6efb4d755ccadd62033 Mon Sep 17 00:00:00 2001 From: MrPixel92 <35262174+MrPixel92@users.noreply.github.com> Date: Sat, 29 Apr 2023 14:31:44 +0300 Subject: [PATCH 2/7] =?UTF-8?q?=D0=97=D0=B0=D0=BB=D0=B8=D0=BB=20=D1=86?= =?UTF-8?q?=D0=B5=D0=BC=D0=B5=D0=BD=D1=82=20=D0=B2=20=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BE=D0=B9=20=D1=81=D0=B8=D1=81=D1=82=D0=B5=D0=BC=D0=B5=20?= =?UTF-8?q?=D0=BE=D1=80=D1=83=D0=B6=D0=B8=D1=8F=20(=D0=BF=D0=BE=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=8F=D0=BB=20=D1=81=D0=BF=D0=BE=D1=81=D0=BE=D0=B1?= =?UTF-8?q?=20=D1=83=D0=B4=D0=B5=D1=80=D0=B6=D0=B0=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BA=D0=B0=D1=80=D1=82=D0=B8=D0=BD=D0=BA=D0=B8=20=D0=B2=D1=8B?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B5=D0=BB=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Теперь оно не тормозит всю игру, а рисуется несколько кадров подряд --- Applications/RayWalk.app/RayEngine.lua | 32 +++++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/Applications/RayWalk.app/RayEngine.lua b/Applications/RayWalk.app/RayEngine.lua index 5da0dbe5..afab1030 100755 --- a/Applications/RayWalk.app/RayEngine.lua +++ b/Applications/RayWalk.app/RayEngine.lua @@ -13,7 +13,6 @@ local filesystem = require("Filesystem") local inputX = 0 local inputY = 0 local inputYaw = 0 - ---------------------------------------------------- Константы ------------------------------------------------------------------ local rayEngine = {} @@ -479,7 +478,12 @@ function rayEngine.toggleWatch() end function rayEngine.drawWeapon() - if rayEngine.currentWeapon.needToFire then screen.drawImage(rayEngine.currentWeapon.xFire, rayEngine.currentWeapon.yFire, rayEngine.currentWeapon.fireTexture); rayEngine.currentWeapon.needToFire = false end +--Пока рисуем, вычитаем время стрельбы + if rayEngine.currentWeapon.needToFire then + screen.drawImage(rayEngine.currentWeapon.xFire, rayEngine.currentWeapon.yFire, rayEngine.currentWeapon.fireTexture); + rayEngine.currentWeapon.needToFire = rayEngine.currentWeapon.needToFire - 1 + end +--Рисуем картинку оружия поверх вспышки, а затем и прицел screen.drawImage(rayEngine.currentWeapon.xWeapon, rayEngine.currentWeapon.yWeapon, rayEngine.currentWeapon.weaponTexture) screen.drawImage(rayEngine.currentWeapon.xCrosshair, rayEngine.currentWeapon.yCrosshair, rayEngine.currentWeapon.crosshairTexture) end @@ -585,10 +589,26 @@ function rayEngine.changeResolution(width, height) end function rayEngine.fire() - rayEngine.currentWeapon.needToFire = true - rayEngine.update() - event.sleep(0.1) - rayEngine.update() +--Если мы уже стреляем, то, естественно, выходим из функции + if rayEngine.currentWeapon.needToFire then return end +--Иначе стреляем + rayEngine.currentWeapon.needToFire = rayEngine.currentWeapon.fireTime + stopYaw() --Останавливаю игрока, т.к. события touch и key_up - злейшие враги всего OpenComputers + if inputY > 0 then + stopY() --Должно спасти жизнь игроку + end +end + +function rayEngine.fireAuto() +--Если мы уже стреляем, то, естественно, выходим из функции + if rayEngine.currentWeapon.needToFire then return end +--Тоже самое, если оружие - пистолет/полуавто винтовка + if not rayEngine.currentWeapon.isAuto then return end +--Иначе стреляем + rayEngine.currentWeapon.needToFire = rayEngine.currentWeapon.fireTime + stopYaw() --Останавливаю игрока, т.к. события touch и key_up - злейшие враги всего OpenComputers + stopX() + stopY() end ---------------------------------------------------------------------------------------------------------------------------------- From 4f41d027210f51e75beb57c1cb74d39223b9d5e8 Mon Sep 17 00:00:00 2001 From: MrPixel92 <35262174+MrPixel92@users.noreply.github.com> Date: Sat, 29 Apr 2023 15:27:38 +0300 Subject: [PATCH 3/7] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B1=D0=B0=D0=BB=D0=B0=D0=BD=D1=81=20=D0=BE=D1=80?= =?UTF-8?q?=D1=83=D0=B6=D0=B8=D1=8F=20=D0=B2=20Weapons.cfg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Applications/RayWalk.app/Weapons/Weapons.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Applications/RayWalk.app/Weapons/Weapons.cfg b/Applications/RayWalk.app/Weapons/Weapons.cfg index ffb0f067..e32b8c30 100755 --- a/Applications/RayWalk.app/Weapons/Weapons.cfg +++ b/Applications/RayWalk.app/Weapons/Weapons.cfg @@ -8,7 +8,7 @@ x = -1, y = -4, }, - fireTime = 3, + fireTime = 5, isAuto = 0, crosshairTexture = "CrosshairTextures/Default.pic", }, @@ -35,7 +35,7 @@ y = 1, }, crosshairTexture = "CrosshairTextures/Angled.pic", - fireTime = 5, + fireTime = 10, isAuto = 0, }, { From cce3d978d12c8b102882354ba505627a5c1b07cb Mon Sep 17 00:00:00 2001 From: MrPixel92 <35262174+MrPixel92@users.noreply.github.com> Date: Sat, 29 Apr 2023 15:28:41 +0300 Subject: [PATCH 4/7] =?UTF-8?q?=D0=9E=D1=82=D1=80=D0=B5=D0=BC=D0=BE=D0=BD?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=20=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=B5=D0=BB=D1=8C=D0=B1=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Applications/RayWalk.app/Main.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Applications/RayWalk.app/Main.lua b/Applications/RayWalk.app/Main.lua index 41eb5879..419f64f3 100755 --- a/Applications/RayWalk.app/Main.lua +++ b/Applications/RayWalk.app/Main.lua @@ -188,6 +188,8 @@ while true do else if rayEngine.currentWeapon then rayEngine.fire() else rayEngine.destroy(3) end end + elseif e[1] == "drop" then + rayEngine.unfire() elseif e[1] == "key_down" then if e[4] > 1 and e[4] < 10 then rayEngine.changeWeapon(e[4] - 2) From b02790557110c969db97dfd35b04af325a9787c5 Mon Sep 17 00:00:00 2001 From: MrPixel92 <35262174+MrPixel92@users.noreply.github.com> Date: Sat, 29 Apr 2023 15:30:37 +0300 Subject: [PATCH 5/7] =?UTF-8?q?=D0=A0=D0=B5=D0=BC=D0=BE=D0=BD=D1=82=20?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B5=D0=BB=D1=8C=D0=B1=D1=8B=20=D0=B7=D0=B0?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=87=D0=B5=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Applications/RayWalk.app/RayEngine.lua | 37 +++++++++++++++----------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/Applications/RayWalk.app/RayEngine.lua b/Applications/RayWalk.app/RayEngine.lua index afab1030..5ed5f9cb 100755 --- a/Applications/RayWalk.app/RayEngine.lua +++ b/Applications/RayWalk.app/RayEngine.lua @@ -1,4 +1,3 @@ - local text = require("Text") local number = require("Number") local color = require("Color") @@ -13,6 +12,7 @@ local filesystem = require("Filesystem") local inputX = 0 local inputY = 0 local inputYaw = 0 +local holdingFire = 0 ---------------------------------------------------- Константы ------------------------------------------------------------------ local rayEngine = {} @@ -169,7 +169,10 @@ function rayEngine.changeWeapon(weaponID) damage = rayEngine.weapons[weaponID].damage, weaponTexture = image.load(rayEngine.weaponsFolder .. rayEngine.weapons[weaponID].weaponTexture), fireTexture = image.load(rayEngine.weaponsFolder .. rayEngine.weapons[weaponID].fireTexture), - crosshairTexture = image.load(rayEngine.weaponsFolder .. rayEngine.weapons[weaponID].crosshairTexture) + crosshairTexture = image.load(rayEngine.weaponsFolder .. rayEngine.weapons[weaponID].crosshairTexture), + fireTime = rayEngine.weapons[weaponID].fireTime, + isAuto = rayEngine.weapons[weaponID].isAuto, + needToFire = 0 } rayEngine.calculateWeaponPosition() else @@ -479,10 +482,10 @@ end function rayEngine.drawWeapon() --Пока рисуем, вычитаем время стрельбы - if rayEngine.currentWeapon.needToFire then - screen.drawImage(rayEngine.currentWeapon.xFire, rayEngine.currentWeapon.yFire, rayEngine.currentWeapon.fireTexture); - rayEngine.currentWeapon.needToFire = rayEngine.currentWeapon.needToFire - 1 + if rayEngine.currentWeapon.needToFire > 1 then + screen.drawImage(rayEngine.currentWeapon.xFire, rayEngine.currentWeapon.yFire, rayEngine.currentWeapon.fireTexture) end +rayEngine.currentWeapon.needToFire = rayEngine.currentWeapon.needToFire - 1 --Рисуем картинку оружия поверх вспышки, а затем и прицел screen.drawImage(rayEngine.currentWeapon.xWeapon, rayEngine.currentWeapon.yWeapon, rayEngine.currentWeapon.weaponTexture) screen.drawImage(rayEngine.currentWeapon.xCrosshair, rayEngine.currentWeapon.yCrosshair, rayEngine.currentWeapon.crosshairTexture) @@ -560,6 +563,8 @@ function rayEngine.update() rayEngine.rotate(rayEngine.player.rotationSpeed * inputYaw) rayEngine.move(rayEngine.player.moveSpeed * inputY, rayEngine.player.moveSpeed * inputX) + if holdingFire == 1 then rayEngine.fireAuto() end + rayEngine.drawWorld() if rayEngine.currentWeapon then rayEngine.drawWeapon() end if rayEngine.minimapEnabled then rayEngine.drawMap(3, 2, 24, 24, 0.5) end @@ -590,25 +595,27 @@ end function rayEngine.fire() --Если мы уже стреляем, то, естественно, выходим из функции - if rayEngine.currentWeapon.needToFire then return end + if rayEngine.currentWeapon.needToFire > 0 then return end --Иначе стреляем + holdingFire = 1 rayEngine.currentWeapon.needToFire = rayEngine.currentWeapon.fireTime - stopYaw() --Останавливаю игрока, т.к. события touch и key_up - злейшие враги всего OpenComputers - if inputY > 0 then - stopY() --Должно спасти жизнь игроку - end + rayEngine.stopYaw() --Останавливаю игрока, т.к. события touch и key_up - злейшие враги всего OpenComputers + +end + +function rayEngine.unfire() + holdingFire = 0 end function rayEngine.fireAuto() --Если мы уже стреляем, то, естественно, выходим из функции - if rayEngine.currentWeapon.needToFire then return end + if rayEngine.currentWeapon.needToFire > 0 then return end --Тоже самое, если оружие - пистолет/полуавто винтовка - if not rayEngine.currentWeapon.isAuto then return end + if rayEngine.currentWeapon.isAuto == 0 then return end --Иначе стреляем rayEngine.currentWeapon.needToFire = rayEngine.currentWeapon.fireTime - stopYaw() --Останавливаю игрока, т.к. события touch и key_up - злейшие враги всего OpenComputers - stopX() - stopY() + rayEngine.stopYaw() --Останавливаю игрока, т.к. события touch и key_up - злейшие враги всего OpenComputers + end ---------------------------------------------------------------------------------------------------------------------------------- From 4df37fcc35fbe662ca3e8f60fbbbcd5f378eb510 Mon Sep 17 00:00:00 2001 From: MrPixel92 <35262174+MrPixel92@users.noreply.github.com> Date: Sat, 29 Apr 2023 19:47:00 +0300 Subject: [PATCH 6/7] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D0=BD=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=B3=D1=80=D0=B0=D1=84=D0=B8=D0=BA=D0=B0=20=D0=B2=D1=81=D0=BF?= =?UTF-8?q?=D1=8B=D1=88=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Weapons/FireTextures/Plasma.pic | Bin 1582 -> 754 bytes .../Weapons/FireTextures/PowderFire.pic | Bin 1187 -> 887 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Applications/RayWalk.app/Weapons/FireTextures/Plasma.pic b/Applications/RayWalk.app/Weapons/FireTextures/Plasma.pic index f97fdb8f455f2e4e2887887d43939465f5122bef..ad855c72dfd4d8b5455c2e26ef3a9f232c87f0d9 100755 GIT binary patch literal 754 zcmZuv*--;A43%y9+;u`=lRa`Qb&w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Mg4<_?GPySyQw{=!H57v`mT6nDmk5^Vve(HIOjR&*6g zJM)Rfj5M7k+J#u}5h8|w@ppmT?#Y~)nA0J{+DO-&E1`mL{ydqHeSYkgh^)HJgUD58b=wBznC|^r?2d^pU0iQ@h!b_D}9n1D{QW8FrU>7TO$}Rw7R7u zgi@?eRR47JbX}EZBPk3}u5!>FkjBQ98aP%%4-3fM=b=c|{AQ`Vsx#;jx6 z_4HO_Q56WD`a>_MUzyocmyW-Pnnp{i(IhNgR!0(R7Nt>0^i7^6_J}lWY#r%KhYhIS NdB#cIdY$XG`yZDWa_j&A diff --git a/Applications/RayWalk.app/Weapons/FireTextures/PowderFire.pic b/Applications/RayWalk.app/Weapons/FireTextures/PowderFire.pic index 89b283c304923fc02e169ee5fbb559602cc46d8e..0cd1812015438f19056037e8233a9db29962f14a 100755 GIT binary patch literal 887 zcmXw1OODe}5UhUxkL@J>#EzX1bvzZ+;dv3sNqLG52?7-^TudBQ2 zRrTi&pFW1Ul0T5A0HDGIQQBDNL(D~4?e>SJJNCnAoX(e7`v29K)@svs|0=3nD{h0X zNF6t1KTMa|D5%*A#2E-{9ufqXDCaqeoU?`E^tmvwtd{GfRRBrXN!9MbNkPYliXVUn zT0u{e0774WyKWcRv&qk)RC9hYw%mH&GcfzHBDG@7i!z*ADpkUd^ zdsWJDtfcD~zyx+DOojGzp_I^8F0HQA%{!nAh=ER+70fq41jiEHGvI(!A|;HOD6Og7 zLRV6h-w6Zi4D<8r7xj*X#Nh=Cd-oR8GZsE(cTf^rE%s>SG}0h8J=ujU0b|6d(OJsH z@C@Z2In~WIDi~edZ-|xqUQI+GQ-VcPlXLzhNWKHf8h-V{*B5U>^151 z2zYy_afCAJqcv`I!I5I{jELC>%aeEUkyvu;;&2Oc+{V{yTVbl*p=nFSX?IPt(fqdF zl7TJ;OMafwZp&6Dy}E1NWA|!jazV52d`1XJ5k;bhPGY)oPJYEzd9z`IVxv=>a+ABx zC=G!TF(KW8L1hgUwVgA8l6r6adIUq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BE=D0=B8=D0=B7=D0=B2=D0=BE=D0=B4=D0=B8?= =?UTF-8?q?=D1=82=D0=B5=D0=BB=D1=8C=D0=BD=D0=BE=D1=81=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Теперь учитывается и время обновления экрана тоже --- Applications/RayWalk.app/RayEngine.lua | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Applications/RayWalk.app/RayEngine.lua b/Applications/RayWalk.app/RayEngine.lua index 5ed5f9cb..345f6f1d 100755 --- a/Applications/RayWalk.app/RayEngine.lua +++ b/Applications/RayWalk.app/RayEngine.lua @@ -13,6 +13,14 @@ local inputX = 0 local inputY = 0 local inputYaw = 0 local holdingFire = 0 + +---------------------------------------------------- Переменные ------------------------------------------------------------------ +local startRenderClock = os.clock() +local endRenderClock = os.clock() +local frameCount = 0 +local fps = 0 +local lastFPSCheck = os.clock() + ---------------------------------------------------- Константы ------------------------------------------------------------------ local rayEngine = {} @@ -558,8 +566,8 @@ function rayEngine.drawWorld() end function rayEngine.update() - local frameRenderClock = os.clock() + local frameRenderClock = os.clock() rayEngine.rotate(rayEngine.player.rotationSpeed * inputYaw) rayEngine.move(rayEngine.player.moveSpeed * inputY, rayEngine.player.moveSpeed * inputX) @@ -577,13 +585,23 @@ function rayEngine.update() if rayEngine.debugInformationEnabled then rayEngine.drawDebugInformation(3, 2 + (rayEngine.minimapEnabled and 12 or 0), 24, 0.6, - "renderTime: " .. string.format("%.2f", (os.clock() - frameRenderClock) * 1000) .. " ms", + "renderTime: " .. string.format("%.2f", ((os.clock() - frameRenderClock) + (endRenderClock-startRenderClock)) * 1000) .. " ms", + "FPS: " .. string.format("%.2f",fps), "freeRAM: " .. string.format("%.2f", computer.freeMemory() / 1024) .. " KB", "pos: " .. string.format("%.2f", rayEngine.player.position.x) .. " x " .. string.format("%.2f", rayEngine.player.position.y) ) end + startRenderClock = os.clock() screen.update() + frameCount = frameCount + 1 + + if (os.clock() - lastFPSCheck) > 1 then + fps = frameCount + frameCount = 0 + lastFPSCheck = os.clock() + end + endRenderClock = os.clock() end ----------------------------------------------------------------------------------------------------------------------------------