Skip to content

Commit

Permalink
Merge pull request #80 from rowan04/play_test_branch_2
Browse files Browse the repository at this point in the history
added button sign to show weapon is armed
  • Loading branch information
Will-Cross1 authored May 2, 2023
2 parents 087960c + 60f4661 commit 4848911
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 65 deletions.
26 changes: 26 additions & 0 deletions maze-game/Armed.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
* Write a description of class Armed here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Armed extends Actor
{
//sets image and size
public Armed()
{
//setImage("Armed_image.jpeg");
GreenfootImage armed = getImage();
armed.scale(25, 25);
}
/**
* Act - do whatever the Armed wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
10 changes: 10 additions & 0 deletions maze-game/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,15 @@ public void act()
{
if(hasZapper == true)
{
Armed armed = new Armed();
getWorld().addObject(armed,412,895);
zap();
}
}
if(Greenfoot.isKeyDown("4") == false)
{
getWorld().removeObjects(getWorld().getObjects(Armed.class));
}

if (useSpeedPotion == true)
{
Expand Down Expand Up @@ -399,6 +405,7 @@ private void zap()
Greenfoot.playSound("zap.mp3");

getWorld().addObject(new Beam(-90), getX(), getY());
getWorld().removeObjects(getWorld().getObjects(Armed.class));
}
if(Greenfoot.isKeyDown("down") == true)
{
Expand All @@ -407,6 +414,7 @@ private void zap()
Greenfoot.playSound("zap.mp3");

getWorld().addObject(new Beam(90), getX(), getY());
getWorld().removeObjects(getWorld().getObjects(Armed.class));
}
if(Greenfoot.isKeyDown("left") == true)
{
Expand All @@ -415,6 +423,7 @@ private void zap()
Greenfoot.playSound("zap.mp3");

getWorld().addObject(new Beam(180), getX(), getY());
getWorld().removeObjects(getWorld().getObjects(Armed.class));
}
if(Greenfoot.isKeyDown("right") == true)
{
Expand All @@ -423,6 +432,7 @@ private void zap()
Greenfoot.playSound("zap.mp3");

getWorld().addObject(new Beam(0), getX(), getY());
getWorld().removeObjects(getWorld().getObjects(Armed.class));
}
}

Expand Down
Binary file added maze-game/images/armed_image.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
118 changes: 53 additions & 65 deletions maze-game/project.greenfoot
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class.Ghost4.image=ghost1.png
class.Ghost_buster_icon.image=ghostBusters.png
class.Intro.image=Intro.png
class.Magnet.image=magnet.png
class.Moveable.image=bomb.png
class.MyWorld.image=greyBackground.png
class.Player.image=man01.png
class.Quit.image=button-red.png
Expand Down Expand Up @@ -148,69 +147,72 @@ dependency44.type=UsesDependency
dependency45.from=Player
dependency45.to=Breakable
dependency45.type=UsesDependency
dependency46.from=Ghost4
dependency46.to=Treasure
dependency46.from=Player
dependency46.to=Puzzel_world_1_tp
dependency46.type=UsesDependency
dependency47.from=Ghost4
dependency47.to=MyWorld
dependency47.to=Treasure
dependency47.type=UsesDependency
dependency48.from=Ghost4
dependency48.to=Beam
dependency48.to=MyWorld
dependency48.type=UsesDependency
dependency49.from=Ghost4
dependency49.to=Player
dependency49.to=Beam
dependency49.type=UsesDependency
dependency5.from=MyWorld
dependency5.to=Ghost3
dependency5.type=UsesDependency
dependency50.from=Ghost3
dependency50.to=Treasure
dependency50.from=Ghost4
dependency50.to=Player
dependency50.type=UsesDependency
dependency51.from=Ghost3
dependency51.to=MyWorld
dependency51.to=Treasure
dependency51.type=UsesDependency
dependency52.from=Ghost3
dependency52.to=Beam
dependency52.to=MyWorld
dependency52.type=UsesDependency
dependency53.from=Ghost3
dependency53.to=Player
dependency53.to=Beam
dependency53.type=UsesDependency
dependency54.from=Ghost2
dependency54.to=Treasure
dependency54.from=Ghost3
dependency54.to=Player
dependency54.type=UsesDependency
dependency55.from=Ghost2
dependency55.to=MyWorld
dependency55.to=Treasure
dependency55.type=UsesDependency
dependency56.from=Ghost2
dependency56.to=Beam
dependency56.to=MyWorld
dependency56.type=UsesDependency
dependency57.from=Ghost2
dependency57.to=Player
dependency57.to=Beam
dependency57.type=UsesDependency
dependency58.from=Ghost1
dependency58.to=Treasure
dependency58.from=Ghost2
dependency58.to=Player
dependency58.type=UsesDependency
dependency59.from=Ghost1
dependency59.to=MyWorld
dependency59.to=Treasure
dependency59.type=UsesDependency
dependency6.from=MyWorld
dependency6.to=Ghost4
dependency6.type=UsesDependency
dependency60.from=Ghost1
dependency60.to=Beam
dependency60.to=MyWorld
dependency60.type=UsesDependency
dependency61.from=Ghost1
dependency61.to=Player
dependency61.to=Beam
dependency61.type=UsesDependency
dependency62.from=End
dependency62.to=Treasure
dependency62.from=Ghost1
dependency62.to=Player
dependency62.type=UsesDependency
dependency63.from=End
dependency63.to=Player
dependency63.to=Treasure
dependency63.type=UsesDependency
dependency64.from=End
dependency64.to=MyWorld
dependency64.to=Player
dependency64.type=UsesDependency
dependency65.from=End
dependency65.to=MyWorld
dependency65.type=UsesDependency
dependency7.from=MyWorld
dependency7.to=WallBreaker
dependency7.type=UsesDependency
Expand All @@ -220,12 +222,12 @@ dependency8.type=UsesDependency
dependency9.from=MyWorld
dependency9.to=SpeedPotion
dependency9.type=UsesDependency
editor.fx.0.height=830
editor.fx.0.width=780
editor.fx.0.x=760
editor.fx.0.y=0
editor.fx.0.height=838
editor.fx.0.width=1550
editor.fx.0.x=-7
editor.fx.0.y=-7
height=838
package.numDependencies=64
package.numDependencies=65
package.numTargets=30
project.charset=UTF-8
publish.hasSource=false
Expand All @@ -237,7 +239,7 @@ publish.title=
publish.url=
readme.height=60
readme.name=@README
readme.width=49
readme.width=48
readme.x=10
readme.y=10
simulation.speed=50
Expand All @@ -263,56 +265,56 @@ target11.width=120
target11.x=0
target11.y=0
target12.height=70
target12.name=Puzzel_world_1_tp
target12.name=Ghost_buster_icon
target12.showInterface=false
target12.type=ClassTarget
target12.width=120
target12.x=0
target12.y=0
target13.height=70
target13.name=Ghost_buster_icon
target13.name=Time_option_1
target13.showInterface=false
target13.type=ClassTarget
target13.width=120
target13.x=0
target13.y=0
target14.height=70
target14.name=Time_option_1
target14.name=MyWorld
target14.showInterface=false
target14.type=ClassTarget
target14.width=120
target14.x=0
target14.y=0
target15.height=70
target15.name=MyWorld
target15.name=Player
target15.showInterface=false
target15.type=ClassTarget
target15.width=120
target15.x=0
target15.y=0
target16.height=70
target16.name=Player
target16.name=Magnet
target16.showInterface=false
target16.type=ClassTarget
target16.width=120
target16.x=0
target16.y=0
target17.height=70
target17.name=Magnet
target17.name=WallBreaker
target17.showInterface=false
target17.type=ClassTarget
target17.width=120
target17.x=0
target17.y=0
target18.height=70
target18.name=WallBreaker
target18.name=Zapper
target18.showInterface=false
target18.type=ClassTarget
target18.width=120
target18.x=0
target18.y=0
target19.height=70
target19.name=Zapper
target19.name=Breakable
target19.showInterface=false
target19.type=ClassTarget
target19.width=120
Expand All @@ -326,89 +328,75 @@ target2.width=120
target2.x=0
target2.y=0
target20.height=70
target20.name=Moveable
target20.name=Wall1
target20.showInterface=false
target20.type=ClassTarget
target20.width=120
target20.x=0
target20.y=0
target21.height=70
target21.name=Breakable
target21.name=Ghost4
target21.showInterface=false
target21.type=ClassTarget
target21.width=120
target21.x=0
target21.y=0
target22.height=70
target22.name=Ghost4
target22.name=Ghost3
target22.showInterface=false
target22.type=ClassTarget
target22.width=120
target22.x=0
target22.y=0
target23.height=70
target23.name=Wall1
target23.name=Intro
target23.showInterface=false
target23.type=ClassTarget
target23.width=120
target23.x=0
target23.y=0
target24.height=70
target24.name=Ghost3
target24.name=Ghost2
target24.showInterface=false
target24.type=ClassTarget
target24.width=120
target24.x=0
target24.y=0
target25.height=70
target25.name=Intro
target25.name=Ghost1
target25.showInterface=false
target25.type=ClassTarget
target25.width=120
target25.x=0
target25.y=0
target26.height=70
target26.name=Ghost2
target26.name=SpeedPotion
target26.showInterface=false
target26.type=ClassTarget
target26.width=120
target26.x=0
target26.y=0
target27.height=70
target27.name=Ghost1
target27.name=End
target27.showInterface=false
target27.type=ClassTarget
target27.width=120
target27.x=0
target27.y=0
target28.height=70
target28.name=SpeedPotion
target28.name=Breaker_icon
target28.showInterface=false
target28.type=ClassTarget
target28.width=120
target28.x=0
target28.y=0
target29.height=70
target29.name=End
target29.showInterface=false
target29.type=ClassTarget
target29.width=120
target29.x=0
target29.y=0
target3.height=70
target3.name=SpeedPotion_option_1
target3.showInterface=false
target3.type=ClassTarget
target3.width=140
target3.x=0
target3.y=0
target30.height=70
target30.name=Breaker_icon
target30.showInterface=false
target30.type=ClassTarget
target30.width=120
target30.x=0
target30.y=0
target4.height=70
target4.name=Again
target4.showInterface=false
Expand Down Expand Up @@ -452,7 +440,7 @@ target9.width=120
target9.x=0
target9.y=0
version=3.0.0
width=1550
width=1456
world.lastInstantiated=MyWorld
xPosition=0
yPosition=0
xPosition=1664
yPosition=25

0 comments on commit 4848911

Please sign in to comment.