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

2021/3/4

how to set location from actor to the world

mariq_rasyid29 mariq_rasyid29

2021/3/4

#
for example i taked from one of my actor here the code
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Mat2 here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Mat2 extends Mats
{
    /**
     * Act - do whatever the Mat2 wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        Touching();
    }    
    public void Touching()
    {if (isTouching(Blizzard.class)) 
        { if (getWorld() instanceof ParentsHome) 
           { 
             World pgh = new PlaygameHome();
             pgh.removeObjects(pgh.getObjects(Dialogue.class));
             ((ParentsHome)getWorld()).Back.stop();
             Greenfoot.setWorld(pgh);  
            
        }
     } 
     }
     public void location()
     {((Blizzard)Greenfoot.()).setLocation(778, 107);}
  }
mariq_rasyid29 mariq_rasyid29

2021/3/4

#
but i get error in line 32
danpost danpost

2021/3/4

#
mariq_rasyid29 wrote...
but i get error in line 32
Did you even inspect the line? Greenfoot.() ????
mariq_rasyid29 mariq_rasyid29

2021/3/4

#
mmmm woring type i mean get world() but still erorrs
danpost danpost

2021/3/4

#
Where is the location method being called from?
You need to login to post a reply.