Hello
I have a problem about the movement of Object
I'm confused because when the body is moving object, the hand does not want to follow the movements of the body
In the hands of this I have some coding
What I want is when the body moves, the hand gestures also follow
but the direction of the hand follows the mouse
I have read on topic
http://www.greenfoot.org/topics/1821
But I'm still confused
It's my image
hand and body separately
Please help, thank you
It's the hand code

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class BRS_RH here. * * @author (your name) * @version (a version number or a date) */ public class BRS_RH extends Actor { private int mouseY; private int mouseX; GreenfootImage shg_brs = new GreenfootImage( "/Right Hand/Right Hand_3.png" ); /** * Act - do whatever the BRS_RH wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void shg(){ if (Greenfoot.getMouseInfo() != null ){ mouseY = Greenfoot.getMouseInfo().getY(); mouseX = Greenfoot.getMouseInfo().getX(); turnTowards(mouseX,mouseY); } } public void act() { // Add your action code here. setImage(shg_brs); shg(); } } |