From bbd34812cbcac82d4a24d95023932a81497916ae Mon Sep 17 00:00:00 2001 From: Marlie Date: Tue, 15 Sep 2026 20:06:13 +0200 Subject: [PATCH] Verfolgungsprojektil --- SMIMS-Game/MyWorld.class | Bin 1201 -> 1363 bytes SMIMS-Game/MyWorld.java | 20 +++++++++--------- SMIMS-Game/TargetingProjectile.class | Bin 0 -> 884 bytes SMIMS-Game/TargetingProjectile.ctxt | 9 +++++++++ SMIMS-Game/TargetingProjectile.java | 29 +++++++++++++++++++++++++++ SMIMS-Game/images/blue-draught.png | Bin 0 -> 269 bytes 6 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 SMIMS-Game/TargetingProjectile.class create mode 100644 SMIMS-Game/TargetingProjectile.ctxt create mode 100644 SMIMS-Game/TargetingProjectile.java create mode 100644 SMIMS-Game/images/blue-draught.png diff --git a/SMIMS-Game/MyWorld.class b/SMIMS-Game/MyWorld.class index a5ee6ac3782f7abc29da34534a314e015e390b96..7aeaf1c52719bc79bdae8927336f2cd7827fb29b 100644 GIT binary patch delta 452 zcmZXQJ1m1?6o#Mg|BJTnijYz&u5BYyqSU1>r6o-mEHY|Ih>_Kt&QZzB zP!e5?F<$7@;E+ntc-J~+Mx;`KF0mCWZt1jPYU*VJ)c$I$vLnQVsFa`=)S#}gm{Y3Q zSk&`-o=eJ)X}>41e8X_eV{TiUApEBZAJo@(91I}<{4&=Qx2$*E%!tkWp5lM=cm z>!Ag&L?8Y1GD9B=_*r9sEe1JYh$DiW2+H|7e!MHDTF$bR>kDnBtD z>B3TTKQ@=EYoEkuhU~CAWM-HZQgs!t*sTf4;A!Sbvm~ZKqM4Ti%#Ac@c{FHBWoZ4Y z!JIKMyc)PWFTPGvJrciTUBEIaR#>1U=T*Hjo2=1gof9@Vr@{qW+_259RQF1HRKK2b pUX}EwoOkw#IU4ursnwpafBpjS3fo1bkk*iq$Ra0D+zW$4cMy5LE0Ejr z#$L1|kk;G1BJwC`C`yzRu-bLPksEpA(b)(Y#oj&N`QnBu;)2AIf@=qk?-Q(i7bPyC zB9LeN`ylj(WYgRBD0JQNK@db{?6fpoW(p@%%UID+m$-t4K>0r`^Cs8ZzRG+e(9-Qg z=h!iQXFM`@eP=SU+KFe%!c5znL{a!78GP z8xk$t6vz&rUdGhFQJSNm_bOViP8Lj)G&h zJVU`Ax7}b!t89B?_s#UE?}lBcub!l02Ls3NIiaWQxib@e^hjE>&v_Gzxj6%tlKT`t z3fpccJ>`v-_?W-wEUbNY^Ib3v2kz^53hL*uZmM=+o%N+SMnD>@2|2F!X_?#w_pI?9 z;u{YsJm9LXfdU?Kl?eck@R*jslSQyaE5;c!X#C|V!4h@A*~y?nPC+}bhLnltD|eulfJLJg7t%am9_onMn<*Fpn2 kR%1~kA)bp?iF}G@l&v$l=Xk+-o2>99PpUB%xl-8r2hxtFp#T5? literal 0 HcmV?d00001 diff --git a/SMIMS-Game/TargetingProjectile.ctxt b/SMIMS-Game/TargetingProjectile.ctxt new file mode 100644 index 0000000..c5d0167 --- /dev/null +++ b/SMIMS-Game/TargetingProjectile.ctxt @@ -0,0 +1,9 @@ +#BlueJ class context +comment0.target=TargetingProjectile +comment0.text=\r\n\ Write\ a\ description\ of\ class\ TargetingProjectile\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n +comment1.params= +comment1.target=void\ act() +comment1.text=\r\n\ Act\ -\ do\ whatever\ the\ TargetingProjectile\ wants\ to\ do.\ This\ method\ is\ called\ whenever\r\n\ the\ 'Act'\ or\ 'Run'\ button\ gets\ pressed\ in\ the\ environment.\r\n +comment2.params= +comment2.target=void\ targetPlayer() +numComments=3 diff --git a/SMIMS-Game/TargetingProjectile.java b/SMIMS-Game/TargetingProjectile.java new file mode 100644 index 0000000..fb2b18e --- /dev/null +++ b/SMIMS-Game/TargetingProjectile.java @@ -0,0 +1,29 @@ +import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) + +/** + * Write a description of class TargetingProjectile here. + * + * @author (your name) + * @version (a version number or a date) + */ +public class TargetingProjectile extends Projectile +{ + /** + * Act - do whatever the TargetingProjectile wants to do. This method is called whenever + * the 'Act' or 'Run' button gets pressed in the environment. + */ + public void act() + { + targetPlayer(); + falling(); + } + + public void targetPlayer(){ + Player player = (Player) getWorld().getObjects(Player.class).get(0); + int playerX = player.getX(); + int playerY = player.getY(); + turnTowards(playerX, playerY); + move(5); + } + +} diff --git a/SMIMS-Game/images/blue-draught.png b/SMIMS-Game/images/blue-draught.png new file mode 100644 index 0000000000000000000000000000000000000000..a3ceb9a25f54d299b85d5b3c54be106211eff9a1 GIT binary patch literal 269 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_>3?$zOPHh5G1_3@HuK)l4XJGihfB*k8XMhaC z;ECVAaG)y2k|4ie28U-i(tsSv64!{5;QX|b^2DN42KS=Gf{e^$=lr~~)S{BqBGXup zcR)pHo-U3d6?2jjBv?h5oE;q<6LW;RniLdTV%rtWV$U=gBs4g4FH>`5ahRImG%3(w zVxr3=!2^lByIh-2BuJci@J;jGg@dw-b|f>Nv|u!mWQ&Osm}Ri#foEt%&?5~6R*=j8 a|7T`kZ4$o2byD3N#P@Xdb6Mw<&;$T*I8GA) literal 0 HcmV?d00001