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

zoukm@hotmail.com's Comments

Back to zoukm@hotmail.com's profile

Can you show the codes that makes them chase the man please, I am programing GTA but have issues chasing the stolen car. please help I have just two days to submit my project. Thanks
I am trying the same thing, can you provide me withh this code please. Below is my code for moving stepping in and driving but can;t sep out. ------------------------------------------- import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class Autodief here. * De autodief is opzoek naar burgerautos die na het stelen naar de garage worden gebracht om te worden verkocht. * *Groep J (Kasim, Richard & Wesley) * Versie4 2/11/2013 */ public class Autodief extends Speler{ private int count = 0; private boolean foundcollison; private int character = 0; private GreenfootImage[] runningAnimation; private GreenfootImage[] instappenAnimation; private GreenfootImage standardImage; private int currentRunningAnimation; private int runningAnimationDelay = 0; private int currentinstappenAnimation; private int instappenAnimationDelay = 0; private boolean touchingAuto = false; public Autodief() { animeerAutodief(); } public void animeerAutodief() { runningAnimation = new GreenfootImage[7]; for (int i = 1; i < 7; i++){ runningAnimation[i] = new GreenfootImage("0-" + i + ".png"); } instappenAnimation = new GreenfootImage[7]; for (int i = 1; i < 7; i++){ instappenAnimation[i] = new GreenfootImage("0-" + i + ".png"); } standardImage = new GreenfootImage("0-0.png"); } public void act(){ SpelerBesturing(); DiefAnimatie(); bestuurder(); checkKeyPress(); animateRunning(); } public void animateRunning(){ if (currentRunningAnimation == 7){ currentRunningAnimation = 1; setImage(runningAnimation[currentRunningAnimation]); } else{ setImage(runningAnimation[currentRunningAnimation]); currentRunningAnimation++; } } public void checkKeyPress() { if(Greenfoot.isKeyDown ("p") ) move(1); if(Greenfoot.isKeyDown ("o")) move(-1); if(Greenfoot.isKeyDown ("l") ) // setImage("diefL.png"); turn(4); if(Greenfoot.isKeyDown ("k")) // setImage("diefR.png"); turn(-4); } public boolean bestuurder() { Actor StolenCar = getOneIntersectingObject(GestolenAuto.class); if(StolenCar != null) { return true; } else { return false; } } public void DiefAnimatie(){ if (Greenfoot.isKeyDown("w")){ setImage("diefu.png"); } if (Greenfoot.isKeyDown("a")){ setImage("diefl.png"); } if (Greenfoot.isKeyDown("d")){ setImage("diefr.png"); } if (Greenfoot.isKeyDown("s")){ setImage("diefd.png"); } } } //no effect 28-11-2013 // public void Stelen(){ // if (Greenfoot.isKeyDown("e") && character == 0 && bestuurder()){ // character = 1; // //getWorld().removeObject(this); // } // } //no effect 28-11-2013 // public boolean foundcollison(){ // Actor Politieauto_move = getOneObjectAtOffset(0, 0, Burgerauto.class); // // if(Politieauto_move != null) { // return true; // } else { // return false; // } // } /// // // /** * De auto wordt bestuurd. */// public void besturing() // { // if (Greenfoot.isKeyDown ("up")&& character == 0) //{ /// move(1); //if (getImage() == dief1){ // setImage(dief2); // }else{ // setImage(dief1); // } // } //if (Greenfoot.isKeyDown("down")&& character == 0) // { // move (-1); // if (getImage() == dief){ // setImage(dief1); //}else{ // setImage(dief); // } //} //if (Greenfoot.isKeyDown("left")&& character == 0) //{ // turn (-5); // } //if (Greenfoot.isKeyDown("right")&& character == 0) //{ // turn (5); //} // } //public boolean driver() //{ // Actor StolenCar = getOneObjectAtOffset(0, 0, StolenCar.class); //if(StolenCar != null) { // return false; //} else { // return true; //} // } /// /// /// //
also, please check the codes to see more details. tnx
left, right, up and down for the police. W, E, S and D for the autodief. Tnx