Bouncy Animations of Buffs Spawned - UQdeco2800/2022-studio-2 GitHub Wiki
Summary
This wiki page will explain the how the buffs spawned on the map have their bouncing animations playing, instead of just its' static images prior to this implementation.
This implementation uses the bouncing buff animations documented here.
This is an extension/improvement on the already existing implementation of the Aura Code Logic that is implemented in Sprint 1.
AuraFactory
Located in: source/core/src/main/com/deco2800/game/entities/factories/AuraFactory.java
In the createBaseAura()
method, that is used to create the base buffs, an AnimationRenderComponent
that takes in the bouncy buffs animation atlas filepath is loaded and added to the base buff.
AnimationRenderComponent auraBounce =
new AnimationRenderComponent(
ServiceLocator.getResourceService()
.getAsset("images/CombatItems/animations/BuffBounce/mapBounce.atlas", TextureAtlas.class));
aura.addComponent(auraBounce);
When a buff is created with its respective create____Buff()
method in AuraFactory
, (such as createWeaponDmgBuff()
) the AnimationRenderComponent
that is tied to the base buff is called, and the respective animation of the type of buff is added to the AnimationRenderComponent
by using its animation name defined in the atlas file. The frame duration is set to 0.1ms per frame and the animation's mode is set to looping.
AnimationRenderComponent auraBounce = weaponSpeedBuff.getComponent(AnimationRenderComponent.class);
auraBounce.addAnimation("mapAttackBuff", 0.1f, Animation.PlayMode.LOOP);
Then, the bouncing animation is started by calling the AnimationRenderComponent
's startAnimation()
auraBounce.startAnimation("mapAttackBuff");
Then, the buffs are spawned in the game areas, by creating the buffs through the AuraFactory.create____Buff()
methods.
Back to Combat Items Contents Page
Author
- Eugene Chong
- GitHub: @eugene2341
- Discord: gene#0005
- Slack: Eugene Chong