Jump to content

Recommended Posts

Posted (edited)

Hello everyone!

I have the following code snippet that's supposed to make a "robot" called _scriptedEntity in-game turn to face a given Entity called "entity" and attack the entity if the _scriptedEntity is within range.. I can not for the life of me how ever understand what .swingarm is supposed to do? my thought was that I could use the method to achieve the swinging arm animation of _scriptedEntity.. how ever I don't understand what actual parameters .swingarm is supposed to have and why?

 

_scriptedEntity extends entityCreature

 

tl:dr;
How do I animate _scriptedEntity to swing his arm?

    @Override
    public void attack(Entity entity){
        //turn and face entity
        this._scriptedEntity.faceEntity(entity,360.0f,360.0f);

        //attack target
        if (this.getDistanceTo(entity) <3.0) {

            //swing animation.... wait wat?
            this._scriptedEntity.swingArm();

            //give damage
            entity.getWrappedEntity().attackEntityFrom(DamageSource.GENERIC, 1.0f);
        }
    }

 

Edited by andr4826
Posted

Does your IDE give errors under swingArm? Hover over it and it should give you parameters.

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.