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

2015/9/28

Help. I Need to make than an actor walk between 3 points.

DamaRoja DamaRoja

2015/9/28

#
Heya!! I had 2 problems: 1. I wanna that my actor simulate a walking between 2 points. 2. When i try the third point, my actor just "flash" I mean it put instantly to the next point. 3. I had used if, while... and switch cycles, and nothing works. Can you help me?
danpost danpost

2015/9/28

#
Please post the code in question (best would be to post the entire clalss of the actor in question from line 1 to the end)..
DamaRoja DamaRoja

2015/9/29

#
Heya!! Ty for the reply. I just started to use greenfoot, and I did the tutorials. I need that my actor move between 3 points (located located in the points of a triangle). I saw this method than give the points to my actor, getting the points from the mous click, and I got than my actor turn towars that point. But it's frustranting than my actor move inmediately from point a (for example) to point b. And moreover, I wanted that my actor move between points set in the program. Would you help me? public void act() { MouseInfo mouse=Greenfoot.getMouseInfo(); if (Greenfoot.mouseMoved(null)) { turnTowards(mouse.getX(),mouse.getY()); } if (Greenfoot.mouseClicked(null)) { int A=mouse.getX(); int B=mouse.getY(); setLocation(A,B); }
danpost danpost

2015/9/29

#
DamaRoja wrote...
it's frustranting than my actor move inmediately from point a (for example) to point b.
That is what using the 'setLocation' method does -- places your actor at the location coordinates given. So, if you give it the coordinates of the location of where the mouse was clicked, that is where it will be immediately placed.
And moreover, I wanted that my actor move between points set in the program.
I am a bit confused. You cannot have it move to both mouse click locations and to pre-assigned points. Maybe you can elaborate as to exactly what you want the actor to do (and not do). Give as much information as you can regarding this.
You need to login to post a reply.