From 05f3cabde948f4a413512eb654fff3d2e1b778ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Bure=C5=A1?=
<114904886+PhilipBuresh@users.noreply.github.com>
Date: Sun, 5 Nov 2023 21:44:00 +0100
Subject: [PATCH] Add files via upload
---
README.md | 7 +--
res/img/block_back.png | Bin 0 -> 882 bytes
res/img/bookshelf_back.png | Bin 0 -> 669 bytes
res/img/chain_back.png | Bin 0 -> 222 bytes
res/img/lantern.png | Bin 0 -> 1805 bytes
res/img/torch.png | Bin 0 -> 1759 bytes
res/img/torch1.png | Bin 0 -> 744 bytes
res/js/script.js | 105 +++++++++++++++++++++++++++----------
8 files changed, 79 insertions(+), 33 deletions(-)
create mode 100644 res/img/block_back.png
create mode 100644 res/img/bookshelf_back.png
create mode 100644 res/img/chain_back.png
create mode 100644 res/img/lantern.png
create mode 100644 res/img/torch.png
create mode 100644 res/img/torch1.png
diff --git a/README.md b/README.md
index 6bba3cc..7eee3d5 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,3 @@
# Leap-and-Run
[Play!](https://philipburesh.github.io/Leap-and-Run/)
-Last Update:
- - Opravené animace hráče
- - Přidaný GHOST
- - Přidané PORTALS
- - Předělaná testovací mapa
-![gifmaker_me (1)](https://github.com/PhilipBuresh/Leap-and-Run/assets/114904886/09267e17-b068-4c68-b405-ee9257f0aeda)
+Základní fyzika hry
diff --git a/res/img/block_back.png b/res/img/block_back.png
new file mode 100644
index 0000000000000000000000000000000000000000..47ecfe6ccc5bad7b815794abc004df5c567dc466
GIT binary patch
literal 882
zcmV-&1C9KNP)Px&EJ;K`R9Hu~m&tM>K@3D2vpMk1_J#ldF;4gboG^G{nRqpRWp#DY;0aGf5Dm3R
zDYY_73`V2TxoMhaFc|RoFXMbZckDBl`~m>y^Z7h&;=|%(GHDizMcVZE_?YIW(`kCX
zzrSAviVZ%S%_i-AdV0#Xoln5V<8gxW{QR6zif*-9Wk;-=DS*ULMyT`Ua@jg>aICM_
z>jW?X5Z&9`TRtF&*VorH_wexWqu0cF&kBCK-8QGwDQ9}W-?ss{flcG_IBneRb{Rk!
zHLoIOgL8LxcNwSv3=oHoLbgP>!PqcI&Fh%~vx|5(`+BSwf2r!_snsb`=lXNJRJ3I^I|Awq=sut?R{_zyeK
zhd2P>UMf9C57(_PoR{aa4tNj%7{F2Fe^jrs7Nu05UexNhqXR^(R@eB?8WF_^)r9B(
zJIjPkyg>4~2
z=Z+4TUW`DKc(==U<^aHNj9J-{=dlmKxq9GUvzv6lp0K>H%i@u@&JzJqMWgBkPsb&@
z7yAJl5u-Q7QGzk<>nU|X$L=y3+bzpbprcNA4p$^aSyJ>Rh1egMVVmtf>Lso-G=32**?>l?`<$wAdGz
zHYr!?gUw6)e-Zf~vj@0*9TT00Vi5rXv^bPb%n1^@VYK9ZWKN`MwIAryf!ei%4pf$V7!m_5pbz18NhGT>{fe!0On!$oEA=f`2YX_07*qo
IM6N<$f-~u??f?J)
literal 0
HcmV?d00001
diff --git a/res/img/bookshelf_back.png b/res/img/bookshelf_back.png
new file mode 100644
index 0000000000000000000000000000000000000000..ef79dbcf1101a10e1b6303e816de0dbeb49458a1
GIT binary patch
literal 669
zcmV;O0%HA%P)Px%S4l)cR9HvtmR(O8K^TS4^0BZr(g-b(29&5RwQ7_8|NqddQW6zx5NoYeK|z-J
zc&C|Jc8P!iie`{K9l6xwksP{YkQP*TBZyK^bzY!^U882tG8V7?p8K`DuJ
z{C2tmivXn9E+iy+_NiH{oQXjYP`eR$GJxH38Hxy%>!wj)v+Y2FaE%UpfV+GWiX=Wo
z>j6OOeF)AE4U3fRcp5??eEQ;RhfH{K;7c
z;4skuq{R0YhXx=;=$>)z_+_0Acz7*r`jK|xt>C0!6siSIjHo$lYeG3Ma5x_JH
zd;o2Yb#?Rrpg4~Op_ftU0Ktp8q94zv4OevFsoVSowxn*K9UI_n&RFpGo##Ho%Fecw_T-)?a~4NwFP*YW
zT)9xy@R8gLw+4?R>lnV>o4j>e(Yfob&Ky^w76+Z$*0G#vm+k+k0~KxN#upy16nhw1
zu`1VM69ZoZvoZ541t#{8V}=$DwFze#EH-R=_{~nkXa;xVD+@OE1B?X^qW?EB3!RrR
VSn}@J9-tc;JYD@<);T3K0RSUhR$%}D
literal 0
HcmV?d00001
diff --git a/res/img/lantern.png b/res/img/lantern.png
new file mode 100644
index 0000000000000000000000000000000000000000..a69770f2bb7a7d56a34d904722c531ae603c1551
GIT binary patch
literal 1805
zcmV+o2lDudP)Px*$4Nv%R9Hv7mV0cSWgW-A&wIc0bnR-_F-|~aN(LsNOo$O95@f_I!+$mu*AcrF
zb#sL^F-7VogHkr*I@r2p7cY!5nqx@lTi7eoBBbvp{X@U&v)(hpFw&%S(@8x;S
z^StNO^|E8z1mEP%d(I#4`};iK-}iSRSiqIf=lS&4JkLX+P$2XD+`L~{v0{Y`J~1&d
zC6)jX*L)%71yBht0-Zm9e#*P`_4Sjg%m-r50M&w5q*w^VoB-w$e4!BY0+=rQ)eKir
zVlJszFhHdeW;5Ua6+oyky#zmS0C9Rk2uNAKiVCBn?<)ZK2L^EN+)fQ=3d)UZyQ3=s
zgbJmShs!6oTNpE0KX=i{GB-Lo@-#I8;po
zOBrYsV{rcgjjUUjR_l&c0XXLbXO3u}+|(P1fPwEpQwfLyC;~!6CxGwyV4Q<-fHNRT
zIg*s&Uw`OuFytn<{gH$aGNXM9u&V;d;OBm>4<#4%rkYgy%vbx0sse<82k}%Car(>$
z;>!|(0V(5%6OPlbKD;E+mc(>CiJP?RW88c$A>>ImU5!}*D#6ikQ6C#l46SCuSiRvl
zgSti#h8cjkr2s+!KLF<<1wfo~q$%)5-W7O3V&$`mjEv
zj~i9xoX>fe5VYfT04K%0a0=36PziNQhJ@kOFZ6M2S!Wpb^7`-)&tyRMeuTxHcjy
zzaC$y!VCc3->>4+0|uhVxNCi1(a;D?12D8KxGtYSL<4|uWLD$|0*W-vVQEYnX`RL?^7)96{~B{T0O5b_*U>m)l*R^ZH5{{I)wi0r{pIhv#_`f-5tLx_
z3lzq*gFcRa(~{~w
z_yZ47%<;25x8AA1^;63VbhX}(lcsP{y&2-od{imVDGKn@hjrv_17mO7K{RY9Y}`?!
zai`_!ci%E~;7BW#*pK(w*!7jN0_B8mITGMts|5~@=I4Bw`cp^I!;ia1G
zR{*Lj@Xqx{RS!J&Z@_6r=e`r@+BBG@!1;3Kfv#83+wK9*Lul!Id5Q;8-S!o}*sJOR
zQPeZ4AewL)JZDSyz$rrq4sE{=OnVPc?D;cxwcRZ(%+!Jecx>nE*!SHvU|JC^-##I$
z;73m_zenMwuV^_>%jLY(s8R*uBcczCT$h-Qg%K-EE;(`H+oBI_6n($|4t1@RUGMST
zZ(&!*ZQz_|(~tvOcl;i`Pk&A}r{-<1Wo6j?vCk@+<ap0*>Wk)Yx;?&3X
z-YWsV)cUIQz{}6AyiGN8fv(quiLo>YQ?>dmkZCBZP)vxq`k@yK!u=xuVj7Bpq|1>E
zP#Qp#oR|i3A@Kvb5s7Ii$8n4WO+$Ge;RUe|Jh16_N$djIPJk@9#-S=4Gz{cgR@nzU
z0U*{faf>}5F7E>|!=HZnNJDLdOVLytRdQcZuIff~`}!^_05q|X$lwBk$Ymr5Jh_%t
vE(ws9_rXaBh9u#5`_%3lG+8k)b0hi>z}4+eF|)O$00000NkvXXu0mjf9SLVU
literal 0
HcmV?d00001
diff --git a/res/img/torch.png b/res/img/torch.png
new file mode 100644
index 0000000000000000000000000000000000000000..eef9ba956c9601878b131a2b3c9feee12b83ad59
GIT binary patch
literal 1759
zcmV<51|a!~P)Px*nMp)JR9HvVR$FWwR~i1!Idj{Yo!N`y%i0^;aojj{MQGKul%}L4R4PJNMM{Vi
z!2@rokIh@&`T$Re3WS6N5~|=K2safKsw#qLdXZ==AZeQ>PK#{kQeTp6yz8CanVs92
zgJw2s*@{(-(dtNN&;On8`~C~T7Cs?fqQJO>#hO%W)#QSrux8bkh#3&HLV}De
zL_-nTq7~JGfCo($^-4n_#-}1eUWzvgK{kso#3Tb88Pg4=5myza2D0unWuG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eQ%;21%h><`002ovPDHLkV1j#!
BMl%2a
literal 0
HcmV?d00001
diff --git a/res/img/torch1.png b/res/img/torch1.png
new file mode 100644
index 0000000000000000000000000000000000000000..54659c007b2e6c724d7a1165fc597c185d9072d9
GIT binary patch
literal 744
zcmVP)C&@G)PUv)zv>}G5X`@|9r3gZW`hj*W_!n5jjcXTOxN+;kjp9N#E)*&*
zL|qDk4Jue%qz3IGq^Y4zbec9DCuyI&HyIfvY2Hj5i@gxS%)EE+@1A?+jetE4VJG!(
zU+|FYFX}tW;b`;wD_$~s&tQ9K@%6fZ^GU$E=cXA~02E}lDB$9d2Y24;m^>n4;-LxV
zG`Kg}yPvu2C1;N(Sgn;(5vmeIu26BM1UG=y87+S1sLC!4eGPIXjh@Ic%)fq&&3fH2
zgd+f|LMo=Bp|3%b{pg8|KsxvZo25~Fn|pmhj3teiMuiGg;df+
zzYm&D5Id(r@W&w#V5|BGf}{X-4UO*;$Yoxl;lK;r0F@gd;t5AV^eTK~UI@J=fS{Tx
zPylS?p?}cX8eSE+0akBD37s`9&Vm4ms)%|2Pi`28AJZmvaC{%l3W
zWXglUcpn5qW8I4*w;0Q2;SuwJCm6-gjDdyHD)$(;0BHB-s~7yOfFLIzC8x~JDMaZx
zgP{Oc@Qi^AfF>Lo^s^DXn^IVQ`SfA-7Em*iS{}8T2kicdyBhodyts=aumkX(_4^m#
z&_I~Yyj?65e{^>Q$$>BevedGEO>f|9w*hG7RLnHu-;pbr2HbTM#^dqrRBt2SwT>)gX^BwbdTtET#TmegC>oB6%gR1`z=@-j2$MdHfxD>EgvLKW|^P|*!
zsI8kvFz*3m<@|pEXa|-GR`>rz0b0cF1^alM%J0eptqkd=bJredWk@%j?+<{sXRw0@
azW^-4HZU{%N+JLN002ovPDHLkV1fW!^Hw$h
literal 0
HcmV?d00001
diff --git a/res/js/script.js b/res/js/script.js
index e9327db..66332b3 100644
--- a/res/js/script.js
+++ b/res/js/script.js
@@ -1,7 +1,6 @@
const canvas = document.getElementById('cnv');
-const g = canvas.getContext('2d');
-const p = canvas.getContext('2d');
-const c = canvas.getContext('2d');
+const p = canvas.getContext('2d'); //Platform
+const c = canvas.getContext('2d'); //Character
const text = document.getElementById("text");
const wasd = document.getElementById("wasd");
@@ -50,21 +49,21 @@ let portalCordsY2 = 0;
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
let platformLevel1 = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 6, 0, 11, 9, 4, 0, 1, 4, 4, 4, 1, 4, 4, 4, 4, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 9, 0, 0, 6, 0, 0, 0, 8, 0, 0, 0, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 3, 1, 7, 7, 7, 7, 0, 0, 6, 0, 0, 0, 8, 0, 0, 0, 0, 4, 0, 30, 0,
- 0, 0, 0, 0, 9, 0, 0, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 9, 2, 0, 8, 0, 0, 0, 0, 10, 0, 0, 0,
- 9, 0, 0, 0, 9, 9, 0, 1, 1, 8, 9, 12, 0, 0, 0, 10, 0, 0, 9, 1, 1, 1, 0, 8, 0, 0, 1, 1, 1, 1, 1, 1,
- 1, 0, 0, 0, 9, 9, 0, 0, 0, 8, 9, 0, 0, 0, 10, 1, 10, 0, 9, 1, 4, 8, 0, 7, 0, 0, 0, 4, 0, 0, 8, 0,
- 4, 0, 0, 1, 1, 1, 0, 0, 0, 7, 7, 7, 7, 7, 1, 1, 1, 1, 1, 1, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0,
- 0, 5, 0, 1,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0, 0, 7,
+ 9, 0, 0, 0, 0, 0, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 0, 14, 0, 1, 0, 5, 0, 1,
+ 9, 17, 0, 0, 0, 2, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 1, 9, 17, 17, 7, 7, 17, 17, 1, 0, 0, 0, 0, 0, 1,
+ 9, 17, 17, 9, 9, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 9, 9, 17, 7, 7, 17, 9, 1, 3, 3, 3, 3, 3, 1,
7, 7, 7, 7, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,]
//1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -113,6 +112,21 @@ portal1Image.src = "./res/img/portal1.png";
const portal2Image = new Image();
portal2Image.src = "./res/img/portal2.png";
+const blockBackImage = new Image();
+blockBackImage.src = "./res/img/block_back.png";
+
+const lanternImage = new Image();
+lanternImage.src = "./res/img/lantern.png";
+
+const chainBackImage = new Image();
+chainBackImage.src = "./res/img/chain_back.png";
+
+const torchImage = new Image();
+torchImage.src = "./res/img/torch.png"
+
+const bookshelfBackImage = new Image();
+bookshelfBackImage.src = "./res/img/bookshelf_back.png"
+
let currentFrame = 0;
let currentFramePunch = 0;
@@ -177,7 +191,7 @@ let cordsPortalY1 = 0;
let cordsPortalX2 = 0;
let cordsPortalY2 = 0;
-let drawPlatform = () => {
+const drawPlatform = () => {
xBlock = 0;
yBlock = 0;
for (let index = 0; index < platformLevel1.length; index++) {
@@ -221,12 +235,34 @@ let drawPlatform = () => {
yBlock += 32;
}else{
xBlock += 32;
- }
-
+ }
}
}
-drawPlatform()
+const drawBackBlocks = () => {
+ xBlock = 0;
+ yBlock = 0;
+ for (let index = 0; index < platformLevel1.length; index++) {
+ if(platformLevel1[index] == 13){
+ p.drawImage(blockBackImage, xBlock, yBlock, 32, 32)
+ }else if(platformLevel1[index] == 14){
+ p.drawImage(lanternImage, xBlock, yBlock, 32, 32)
+ }else if(platformLevel1[index] == 15){
+ p.drawImage(chainBackImage, xBlock, yBlock, 32, 32)
+ }else if(platformLevel1[index] == 16){
+ p.drawImage(torchImage, xBlock, yBlock, 32, 32)
+ }else if(platformLevel1[index] == 17){
+ p.drawImage(bookshelfBackImage, xBlock, yBlock, 32, 32)
+ }
+ if((index + 1) % 32 == 0){
+ xBlock = 0;
+ yBlock += 32;
+ }else{
+ xBlock += 32;
+ }
+ }
+
+}
//----------------------------------------Vykreslení Hráče a Ducha
let playerImage = new Image();
@@ -266,9 +302,9 @@ const drawGhost = () => {
ghostImage.src = "./res/img/ghost.png";
xGhost += ghostVelocity;
if(ghostVelocity == 0.25){
- g.drawImage(ghostImage, ghostFrame1 * 30, 0 * 40, 30, 40, xGhost, yGhost, 30, 40);
+ c.drawImage(ghostImage, ghostFrame1 * 30, 0 * 40, 30, 40, xGhost, yGhost, 30, 40);
}else{
- g.drawImage(ghostImage, ghostFrame2 * 30, 0 * 40, 30, 40, xGhost, yGhost, 30, 40);
+ c.drawImage(ghostImage, ghostFrame2 * 30, 0 * 40, 30, 40, xGhost, yGhost, 30, 40);
}
for (let i = 0; i < platformLevel1.length; i++) {
if (platformLevel1[i] == 1 || platformLevel1[i] == 2 || platformLevel1[i] == 6 || platformLevel1[i] == 7 || platformLevel1[i] == 9) {
@@ -302,8 +338,9 @@ const drawGhost = () => {
setInterval(() => {
//Hráč
- drawPlayer();
- //Ghost
+ drawPlayer();
+ //Platformy
+ drawPlatform();
//Lava
intervalLava++;
if(intervalLava == 70){
@@ -392,59 +429,73 @@ let drawPlayer = () => {
playerImage.src = "./res/img/player.png";
if(velocity == 0 && velocityJump == 0 && !isMovingRight && !isMovingLeft && turnedRight && !punched && !crouched){ //Right Stand
c.clearRect(0, 0, canvas.width, canvas.height);
+ drawBackBlocks();
c.drawImage(playerImage, currentFrame * sX, 0 * sY, sWidth, sHeight, x, y, frameWidth, frameHeight);
animate24();
}else if(velocity == 0 && velocityJump == 0 && !isMovingRight && !isMovingLeft && turnedLeft && !punched && !crouched){ //Left Stand
c.clearRect(0, 0, canvas.width, canvas.height);
+ drawBackBlocks();
c.drawImage(playerImage, currentFrame * sX, 1 * sY, sWidth, sHeight, x, y, frameWidth, frameHeight);
animate24();
}else if(velocity > 0 && turnedRight && !punched && !crouched){ //Right Fall
c.clearRect(0, 0, canvas.width, canvas.height);
+ drawBackBlocks();
c.drawImage(playerImage, 0 * sX, 0 * sY, sWidth, sHeight, x, y, frameWidth, frameHeight);
}else if(velocity > 0 && turnedLeft && !punched && !crouched){ //Left Fall
c.clearRect(0, 0, canvas.width, canvas.height);
+ drawBackBlocks();
c.drawImage(playerImage, 0 * sX, 1 * sY, sWidth, sHeight, x, y, frameWidth, frameHeight);
}else if(velocityJump > 0 && turnedRight && !punched && !crouched){ //Right Jump
c.clearRect(0, 0, canvas.width, canvas.height);
+ drawBackBlocks();
c.drawImage(playerImage, 0 * sX, 4 * sY, sWidth, sHeight, x, y, frameWidth, frameHeight);
}else if(velocityJump > 0 && turnedLeft && !punched && !crouched){ //Left Jump
c.clearRect(0, 0, canvas.width, canvas.height);
+ drawBackBlocks();
c.drawImage(playerImage, 0 * sX, 5 * sY, sWidth, sHeight, x, y, frameWidth, frameHeight);
}else if(velocity == 0 && velocityJump == 0 && isMovingRight && !punched && !crouched ){ //Right Run
c.clearRect(0, 0, canvas.width, canvas.height);
+ drawBackBlocks();
c.drawImage(playerImage, currentFrame * sX, 2 * sY, sWidth, sHeight, x, y, frameWidth, frameHeight);
animate8();
}else if(velocity == 0 && velocityJump == 0 && isMovingLeft && !punched && !crouched){ //Left Run
c.clearRect(0, 0, canvas.width, canvas.height);
+ drawBackBlocks();
c.drawImage(playerImage, currentFrame * sX, 3 * sY, sWidth, sHeight, x, y, frameWidth, frameHeight);
animate8();
}else if(punched && turnedRight){ //Right Punch
c.clearRect(0, 0, canvas.width, canvas.height);
+ drawBackBlocks();
c.drawImage(playerImage, currentFramePunch * sX, 8 * sY, sWidth, sHeight, x, y, frameWidth, frameHeight);
animate6();
}else if(punched && turnedLeft){ //Left Punch
c.clearRect(0, 0, canvas.width, canvas.height);
+ drawBackBlocks();
c.drawImage(playerImage, currentFramePunch * sX, 9 * sY, sWidth, sHeight, x, y, frameWidth, frameHeight);
animate6();
}else if(crouched && !isMovingRight && !isMovingLeft && turnedRight){ //Crouched Right
c.clearRect(0, 0, canvas.width, canvas.height);
+ drawBackBlocks();
c.drawImage(playerImage, 0 * sX, 6 * sY, sWidth, sHeight, x, y - height, frameWidth, frameHeight);
}else if(crouched && !isMovingRight && !isMovingLeft && turnedLeft){ //Crouched Left
c.clearRect(0, 0, canvas.width, canvas.height);
+ drawBackBlocks();
c.drawImage(playerImage, 0 * sX, 7 * sY, sWidth, sHeight, x, y - height, frameWidth, frameHeight);
}else if(crouched && isMovingRight && !isMovingLeft){ //Crouched Right Moving
c.clearRect(0, 0, canvas.width, canvas.height);
+ drawBackBlocks();
c.drawImage(playerImage, currentFrame * sX, 6 * sY, sWidth, sHeight, x, y - height, frameWidth, frameHeight);
animate4();
}else if(crouched && isMovingLeft && !isMovingRight){ //Crouched Left Moving
c.clearRect(0, 0, canvas.width, canvas.height);
+ drawBackBlocks();
c.drawImage(playerImage, currentFrame * sX, 7 * sY, sWidth, sHeight, x, y - height, frameWidth, frameHeight);
animate4();
}
+ drawPlatform();
drawGhost();
objectsCollision();
orbCollision();
- drawPlatform();
};
//----------------------------------------SHAKE funkce