Verfolgungsprojektil
This commit is contained in:
Binary file not shown.
@@ -9,4 +9,8 @@ comment2.target=void\ prepare()
|
||||
comment2.text=\r\n\ Prepare\ the\ world\ for\ the\ start\ of\ the\ program.\r\n\ That\ is\:\ create\ the\ initial\ objects\ and\ add\ them\ to\ the\ world.\r\n
|
||||
comment3.params=
|
||||
comment3.target=void\ act()
|
||||
numComments=4
|
||||
comment4.params=
|
||||
comment4.target=void\ projectile()
|
||||
comment5.params=
|
||||
comment5.target=void\ targetingProjectile()
|
||||
numComments=6
|
||||
|
||||
+26
-1
@@ -33,10 +33,29 @@ public class MyWorld extends World
|
||||
addObject(player,302,320);
|
||||
Score score = new Score();
|
||||
addObject(score, 200, 50);
|
||||
Plattform plattform = new Plattform();
|
||||
addObject(plattform,285,577);
|
||||
plattform.setLocation(286,492);
|
||||
plattform.setLocation(293,379);
|
||||
removeObject(plattform);
|
||||
Plattform plattform2 = new Plattform();
|
||||
addObject(plattform2,291,373);
|
||||
Plattform plattform3 = new Plattform();
|
||||
addObject(plattform3,123,268);
|
||||
plattform3.setLocation(136,306);
|
||||
Plattform plattform4 = new Plattform();
|
||||
addObject(plattform4,294,204);
|
||||
Plattform plattform5 = new Plattform();
|
||||
addObject(plattform5,105,112);
|
||||
plattform2.setLocation(320,367);
|
||||
plattform2.setLocation(312,371);
|
||||
plattform2.setLocation(308,382);
|
||||
}
|
||||
|
||||
public void act()
|
||||
{
|
||||
projectile();
|
||||
targetingProjectile();
|
||||
if(PlattformCountdown==0) //Damit in regelmäßigen Abständen auf jeden Fall eine Plattform auftaucht
|
||||
{
|
||||
addObject(new Plattform(), Greenfoot.getRandomNumber(400), 5);
|
||||
@@ -59,6 +78,10 @@ public class MyWorld extends World
|
||||
{
|
||||
addObject(new BreakingPlattform(50), Greenfoot.getRandomNumber(400), 6); //Nach Links bewegende Plattform
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void projectile(){
|
||||
if(timer == 0){
|
||||
Projectile projectile = new Projectile();
|
||||
addObject(projectile,Greenfoot.getRandomNumber(300)+50,0);
|
||||
@@ -67,6 +90,9 @@ public class MyWorld extends World
|
||||
else{
|
||||
timer = timer - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void targetingProjectile(){
|
||||
if(targetTimer == 0){
|
||||
TargetingProjectile targetingProjectile = new TargetingProjectile();
|
||||
addObject(targetingProjectile, Greenfoot.getRandomNumber(300)+50,0);
|
||||
@@ -76,5 +102,4 @@ public class MyWorld extends World
|
||||
targetTimer = targetTimer - 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -23,7 +23,7 @@ public class TargetingProjectile extends Projectile
|
||||
int playerX = player.getX();
|
||||
int playerY = player.getY();
|
||||
turnTowards(playerX, playerY);
|
||||
move(5);
|
||||
move(3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.4 KiB |
+133
-12
@@ -1,25 +1,76 @@
|
||||
#Greenfoot project file
|
||||
class.Button.image=button-red.png
|
||||
class.GameOverWorld.image=GameOverBackground.png
|
||||
class.Ground.image=weave.jpg
|
||||
class.MyWorld.image=GameBackground.png
|
||||
class.Player.image=ppl2.png
|
||||
dependency1.from=PlayerTestWorld
|
||||
dependency1.to=Ground
|
||||
class.Projectile.image=Projectile1.png
|
||||
class.StartWorld.image=StartBackground.png
|
||||
class.TargetingProjectile.image=blue-draught.png
|
||||
dependency1.from=GameOverWorld
|
||||
dependency1.to=Button
|
||||
dependency1.type=UsesDependency
|
||||
dependency10.from=MyWorld
|
||||
dependency10.to=Projectile
|
||||
dependency10.type=UsesDependency
|
||||
dependency11.from=Player
|
||||
dependency11.to=GameOverWorld
|
||||
dependency11.type=UsesDependency
|
||||
dependency12.from=Player
|
||||
dependency12.to=Ground
|
||||
dependency12.type=UsesDependency
|
||||
dependency13.from=Player
|
||||
dependency13.to=Projectile
|
||||
dependency13.type=UsesDependency
|
||||
dependency14.from=Plattform
|
||||
dependency14.to=MyWorld
|
||||
dependency14.type=UsesDependency
|
||||
dependency15.from=Plattform
|
||||
dependency15.to=Player
|
||||
dependency15.type=UsesDependency
|
||||
dependency16.from=MovingPlattform
|
||||
dependency16.to=MyWorld
|
||||
dependency16.type=UsesDependency
|
||||
dependency17.from=Button
|
||||
dependency17.to=MyWorld
|
||||
dependency17.type=UsesDependency
|
||||
dependency18.from=PowerUps
|
||||
dependency18.to=Player
|
||||
dependency18.type=UsesDependency
|
||||
dependency19.from=JumpBoostItem
|
||||
dependency19.to=Player
|
||||
dependency19.type=UsesDependency
|
||||
dependency2.from=PlayerTestWorld
|
||||
dependency2.to=Player
|
||||
dependency2.to=Ground
|
||||
dependency2.type=UsesDependency
|
||||
dependency3.from=MyWorld
|
||||
dependency3.from=PlayerTestWorld
|
||||
dependency3.to=Player
|
||||
dependency3.type=UsesDependency
|
||||
dependency4.from=Player
|
||||
dependency4.to=Ground
|
||||
dependency4.from=PlayerTestWorld
|
||||
dependency4.to=JumpBoostItem
|
||||
dependency4.type=UsesDependency
|
||||
dependency5.from=StartWorld
|
||||
dependency5.to=Button
|
||||
dependency5.type=UsesDependency
|
||||
dependency6.from=MyWorld
|
||||
dependency6.to=Player
|
||||
dependency6.type=UsesDependency
|
||||
dependency7.from=MyWorld
|
||||
dependency7.to=Plattform
|
||||
dependency7.type=UsesDependency
|
||||
dependency8.from=MyWorld
|
||||
dependency8.to=MovingPlattform
|
||||
dependency8.type=UsesDependency
|
||||
dependency9.from=MyWorld
|
||||
dependency9.to=BreakingPlattform
|
||||
dependency9.type=UsesDependency
|
||||
editor.fx.0.height=737
|
||||
editor.fx.0.width=814
|
||||
editor.fx.0.x=360
|
||||
editor.fx.0.y=26
|
||||
height=830
|
||||
package.numDependencies=4
|
||||
package.numTargets=4
|
||||
package.numDependencies=19
|
||||
package.numTargets=14
|
||||
project.charset=UTF-8
|
||||
publish.hasSource=false
|
||||
publish.locked=true
|
||||
@@ -41,29 +92,99 @@ target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=0
|
||||
target1.y=0
|
||||
target10.height=70
|
||||
target10.name=TargetingProjectile
|
||||
target10.showInterface=false
|
||||
target10.type=ClassTarget
|
||||
target10.width=120
|
||||
target10.x=0
|
||||
target10.y=0
|
||||
target11.height=70
|
||||
target11.name=Projectile
|
||||
target11.showInterface=false
|
||||
target11.type=ClassTarget
|
||||
target11.width=120
|
||||
target11.x=0
|
||||
target11.y=0
|
||||
target12.height=70
|
||||
target12.name=Button
|
||||
target12.showInterface=false
|
||||
target12.type=ClassTarget
|
||||
target12.width=120
|
||||
target12.x=0
|
||||
target12.y=0
|
||||
target13.height=70
|
||||
target13.name=PowerUps
|
||||
target13.showInterface=false
|
||||
target13.type=ClassTarget
|
||||
target13.width=120
|
||||
target13.x=0
|
||||
target13.y=0
|
||||
target14.height=70
|
||||
target14.name=MyWorld
|
||||
target14.showInterface=false
|
||||
target14.type=ClassTarget
|
||||
target14.width=120
|
||||
target14.x=0
|
||||
target14.y=0
|
||||
target2.height=70
|
||||
target2.name=Ground
|
||||
target2.name=MovingPlattform
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=0
|
||||
target2.y=0
|
||||
target3.height=70
|
||||
target3.name=PlayerTestWorld
|
||||
target3.name=Ground
|
||||
target3.showInterface=false
|
||||
target3.type=ClassTarget
|
||||
target3.width=120
|
||||
target3.x=0
|
||||
target3.y=0
|
||||
target4.height=70
|
||||
target4.name=MyWorld
|
||||
target4.name=JumpBoostItem
|
||||
target4.showInterface=false
|
||||
target4.type=ClassTarget
|
||||
target4.width=120
|
||||
target4.x=0
|
||||
target4.y=0
|
||||
target5.height=70
|
||||
target5.name=BreakingPlattform
|
||||
target5.showInterface=false
|
||||
target5.type=ClassTarget
|
||||
target5.width=120
|
||||
target5.x=0
|
||||
target5.y=0
|
||||
target6.height=70
|
||||
target6.name=GameOverWorld
|
||||
target6.showInterface=false
|
||||
target6.type=ClassTarget
|
||||
target6.width=120
|
||||
target6.x=0
|
||||
target6.y=0
|
||||
target7.height=70
|
||||
target7.name=PlayerTestWorld
|
||||
target7.showInterface=false
|
||||
target7.type=ClassTarget
|
||||
target7.width=120
|
||||
target7.x=0
|
||||
target7.y=0
|
||||
target8.height=70
|
||||
target8.name=StartWorld
|
||||
target8.showInterface=false
|
||||
target8.type=ClassTarget
|
||||
target8.width=120
|
||||
target8.x=0
|
||||
target8.y=0
|
||||
target9.height=70
|
||||
target9.name=Plattform
|
||||
target9.showInterface=false
|
||||
target9.type=ClassTarget
|
||||
target9.width=120
|
||||
target9.x=0
|
||||
target9.y=0
|
||||
version=3.1.0
|
||||
width=1550
|
||||
world.lastInstantiated=PlayerTestWorld
|
||||
world.lastInstantiated=MyWorld
|
||||
xPosition=0
|
||||
yPosition=0
|
||||
|
||||
Reference in New Issue
Block a user