Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.