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

2012/11/16

Range

jdc4aub jdc4aub

2012/11/16

#
I'm creating a game where when an enemy gets within some distance of the user's right hand, the enemy is killed. I am using a Kinect.
    public void act() 
    {
        PaintWorld world = (PaintWorld)getWorld();
       

        UserData[] users = world.getTrackedUsers();
        for (UserData user : users)
        {
            Joint rightHand = user.getJoint(Joint.RIGHT_HAND);
                        {
if (getObjectsInRange (100,Zombie.class).size() > 0)
             {
                                getWorld().removeObject(this);     
                  }  
      else
      if (getObjectsInRange (100,Zombie.class).size() > 0)
      {
          h = h++;
          getWorld().removeObject(this);
That is what I was working with, I'm not sure how to make the transition from this code to the code that finds enemies in range of the right hand.
You need to login to post a reply.