How do I properly implement Java animations?

I have the following.

// in the animation class
public void update () {
timer + = System.currentTimeMillis () - lastTime;
lastTime = System.currentTimeMillis ();

if (timer> speed) {
Play = true;
index ++;

timer = 0;
if (index> = frames.length) {
Index = 0;
Play = wrong;

} // down and down

In the main state

public void update () {
Ability.update ();
if (AttackP.isPlaying ()) {
AttackP.update ();


// gets
Health control ();
getMousePosition ();

                if (turn == true) {// Execute only when it's your turn
if (MousePressed &&! AttackP.isPlaying () &&! AttackingP) {
// when the left mouse button is clicked, when no animations are playing and when AttackingP is false
buttonCheck (g); // next
} else if (! MousePressed) {// set Attacking to false if the mouse is not pressed
AttackingP = false;

private void buttonCheck (graphic g) {
if (MouseX<501&&MouseX>420 && MouseY<531&&MouseY>500) {// if the mouse is in this key

AttackingP = true;
StartAnimation (g);


                private void start animation (graphic g) {

g.drawImage (getCurrentAnimationFrame (), 175,0,512 / 2,512 / 2, null) // Play animation
BossHealth = 5;
turn = false;


public BufferedImage getCurrentAnimationFrame () {
return AttackP.getCurrentFrame ();

The problem is, when I press the button, only 1 frame is rendered in the animation, not the others in the BufferedImage array.

Help appreciated, I am now stuck for 2 days on this part.

To implement wallet management for Android apps using magento2 rest api

I need to implement a wallet system in a mobile app with Magento2. There are 2 functionalities that I have to implement, which are given below.

1- Get money from the customer market.

2- Use of wallet money when ordering.

I searched a lot, but found no endpoint for wallet in magento-2. I also got confused which table to use if an endpoint does not exist. I have to apply this functionality to Mobile App with Magento-2.

c ++ – Implement objects and retrieve lists, filters, and invoking methods. Low-level system code

I think about system-level code and wonder how to implement objects whose fields can be accessed.

So if we have an object called task, with members like tid and kill.
we could hit the tide by calling task-> tid. No, what if we had to deal with many task objects, eg. For example, if we want to finish all tasks with a tid> 100.

How could this be done properly? A naive implementation might go through every object and check the messages, but that's not enough. The object can be changed or modified in some way to make it robust and powerful. As long as we find out where new methods are and how the results are accessed, I can better understand how this could be addressed.

Mathematics – How to Implement the Meshlab Rotation Manipulator?

I want to implement a twist grip / manipulator mechanism that allows the user to rotate a 3D model just like Meshlab does.

Unfortunately, I do not quite understand how the rotation gizmo works. In particular, I do not understand how the model can only be rotated around the Z-axis. Open Meshlab and turn it just the blue circle to see what I mean. Rotations around the X and Y axis are easy for me to understand.

How to recreate the rotation mechanism of Meshlab, d. H. Like exactly Does horizontal and vertical panning shift into angle changes?

Meshlab-rotation Gizmo

Implement a scrollable panel in XNA / MonoGame

I'm trying to create a scroll box for my game. The code I showed below is working but there is a problem.

I read Andrew's answer here and decided to implement the scrolling effect using a translation matrix. However, my controls (buttons, combo boxes, and so on) have a solid rectangle on the screen (the rectangle I use to check if the cursor is over the control). As I found out, the matrix translation only moves the texture of the control, not the rectangle.

The problem:

So, when I scroll down and click where the button was originally in the panel, the Click event fires even though the button's texture is "out of the box." scissorRectangle,

What I have considered:

  1. I thought I should disable the interaction with controls outside of scissorRectangleBut what about controls that are still partially visible?

  2. If the matrix translation does not work, I thought about going through the panels _controls List the offset and send it to each control (ugh) where it adjusts its rectangle position. : /

I have the following code for my panel:

// ...
private RasterizerState _rasterizerState = new RasterizerState () {ScissorTestEnable = true};
private Vector2 _scrollOffset = Vector2.Zero;
private matrix _matrix = Matrix.Identity;
// ...

in the To update():

_matrix = Matrix.CreateTranslation (new Vector3 (_scrollOffset, 0));
if (Enables && BorderBox.Intersects (inputManager.MouseRect))
if (inputManager.ScrolledDown ())
if (_combinedRowHeight - (ContentBox.Height -scrollOffset.Y)> -combinedTextHeight)
_scrollOffset.Y - = 14;
otherwise if (inputManager.ScrolledUp ())
if (_scrollOffset.Y <0)
_scrollOffset.Y + = 14;

And then in To draw():

// Save the previous RasterizerState
RasterizerState oldState = spriteBatch.GraphicsDevice.RasterizerState;
// Save the original scissors rectangle
Rectangle currentScissorRect = spriteBatch.GraphicsDevice.ScissorRectangle;

spriteBatch.End ();

spriteBatch.Begin ();
// Draw the control panel
spriteBatch.End ();

spriteBatch.Begin (SpriteSortMode.Immediate, BlendState.AlphaBlend, rasterizerState: _rasterizerState, transformMatrix: _matrix);

spriteBatch.GraphicsDevice.ScissorRectangle = ContentBox;

if (_drawControls)
for (int i = 0; i <_rows.Count; i ++)
_Reihen[i].Draw (SpriteBatch);

spriteBatch.End ();

// Restore the scissors rectangle
spriteBatch.GraphicsDevice.ScissorRectangle = currentScissorRect;

// Restore the RasterizerState
spriteBatch.Begin (rasterizerState: oldState);

Is there no other way? Should I simply send the offset to controls and change their position? Can not the matrix approach be used for interactive controls?

Hash – Can we implement custom algorithms to encode and decode Wi-Fi password hashes between Windows 10 and our router?

Windows 10 has its own method for encrypting hashes, but they can be brutally enforced by Hashcat. One of our students has created two proprietary password encryption algorithms in Python (one for encryption, one for decryption). Is there a way to implement its algorithms on our Windows 10 PC and router so that the algorithm encrypts the WLAN password, creates a hash, and then sends it to the PC that reads the hash and then uses the decoding algorithm, to get that? correct password.

How to implement VFX?

This seems like a strange question, but I wanted to implement VFX in one of my games, similar to what we see in First Ant Man. Especially only that

  1. What do you call such a VFX / objects? Is there a term for it?
  2. I assume that this is a job for a 3D artist. If so, which approach is best for achieving this? Of course we are looking for less details than in the movie

Enter the description of the link here

Enter the description of the link here