I am stuck on this and i was wandering if anyone could shed some light on my problem :)\
I cant find how to make an object that other objects cant pass through. For example in my game the player plays as a rocket and I want to make it so that it cant pass through some "wall" i have put in.
I couln't think of another way soi tried adding an if(canSee(Wall.class)) clause..
public void stopatWall()
{
if(canSee(Wall.class))
{
acceleration = new Vector(0, 0);
increaseSpeed(new Vector(0, 0));
Greenfoot.stop(); (I think i need to change this part)
}
}
with the wall being
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Wall here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Wall extends Actor
{public Wall()
{
GreenfootImage image= getImage();
image.scale(31,31);
}
/**
* Act - do whatever the Wall 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.
}
This works except i cant find a command that just stops the rocket not the entire game
Can anyone help?
Thanks,
FuRiAx

