This site requires JavaScript, please enable it in your browser!
Greenfoot back
BradH
BradH wrote ...

2012/10/15

Problem

1
2
3
BradH BradH

2012/10/16

#
the projectile is going about 4x farther than it did before it leaves the gun but it disappears in the middle of the world
Game/maniac Game/maniac

2012/10/16

#
But if you do !atWorldEdge() it might work
BradH BradH

2012/10/16

#
It works if i shoot to the side but if i shoot up the middle they disappear (like there is some sort of barrier blocking them ) I might check my world properties to see if something is screwed up in there
Game/maniac Game/maniac

2012/10/16

#
What is the code for the class that creates the projectile
BradH BradH

2012/10/16

#
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class GumBlaster here. * * @author (your name) * @version (a version number or a date) */ public class GumBlaster extends Actor {private int points = 0; public void act() { if (Greenfoot.isKeyDown("left")) { setRotation (getRotation() - 3); } if (Greenfoot.isKeyDown("right")) { setRotation (getRotation() + 3); } if("space".equals(Greenfoot.getKey())) { fire(); } if (Greenfoot.isKeyDown("z")) { snipe(); points--; } } /** * Fire the GumBlaster. */ private void fire() { Mover gum = new gum(); getWorld().addObject(gum, getX(), getY()); gum.setRotation(getRotation()); gum.move(6); } /** * Snipe the GumBlaster */ private void snipe() { Mover longshot = new longshot(); getWorld().addObject(longshot, getX(), getY()); longshot.setRotation(getRotation()); longshot.move(6); } } snipe is the method that shoots longshot
Game/maniac Game/maniac

2012/10/16

#
Try doing this.getRotation() If that don't do anything change Mover longshot to Actor longshot
BradH BradH

2012/10/16

#
Still no luck
Game/maniac Game/maniac

2012/10/16

#
Share the level with the source code and I will take a look at it and hopefully fix the bug
BradH BradH

2012/10/16

#
ok thank you (some of my subclasses are lower case would it make it easier if I made them capitilized)?
BradH BradH

2012/10/16

#
It is up on the website
BradH BradH

2012/10/17

#
how is it goin?
danpost danpost

2012/10/17

#
The first line in the 'disappear' method in the Longshot class should be
if (atWorldEdge())
Game/maniac Game/maniac

2012/10/17

#
I cant find your scenario so i cant download the source code
BradH BradH

2012/10/17

#
Should be able to find it now, sorry
Game/maniac Game/maniac

2012/10/17

#
You need to add the source code
There are more replies on the next page.
1
2
3