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

2016/11/17

Have a Problem with my Script :/

H0ly1812 H0ly1812

2016/11/17

#

Hey Guys, i dont know why but my Greenfoot say, that cannot find symbohl- variable pLinks

import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Schlange here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Schlange extends Actor

{
    boolean zLinks;
    
    /**
     * Act - do whatever the Auto wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    
    public Schlange (boolean pinks, String pBild)
    {
        zLinks = pLinks; // <-- The Error
        this.setImage(pBild);
    }
    
    public void act() 
    
    {
        if(this.getX()<0)
        {
            zLinks = false;
        }
        if(this.getX()> 700)
        {
            zLinks = true;
        }
        if(zLinks)
        {
            this.setLocation(this.getX()-1, this.getY()); 
        }
        else
        {
            this.setLocation(this.getX()+1, this.getY());
        }
    
    
    }
    
    
    
    
    }    
Please help me. Thank you for your Support :)
Super_Hippo Super_Hippo

2016/11/17

#
In line 19, you have 'pinks' and in line 21 it is 'pLinks'. I think it should be the same.
H0ly1812 H0ly1812

2016/11/24

#
Ok it works thanks
You need to login to post a reply.