0
\$\begingroup\$

I am developing following type of game Roulette Royale.

I am basically ready with wheel and number table. When user move wheel table then ball also move on that table and stop at particular number and reply to number table with that number.

Right now I only used RotationModifier and there is no position change at present only ball rotate and stop at randomly selected number. This thing work well.

But I want ball start its movement from out side the wheel and slowly move inside in to the wheel. It perform rotation as well as smoothly move towards the center of the wheel. This functionality I don't able to conceptualise how to create?

I think there is no need to put any code snippet here because I need only concept how to perform this task. Thanks in advance efforts you take for me.

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

I have found solution for my problem, here I paste it to help other members.

             ballSprite = new Sprite(wheelSprite.getWidth() * 0.5f,
                            wheelSprite.getHeight() * 0.5f, ballRegion.getWidth() * 0.6f,
                            ballRegion.getHeight() * 0.6f, ballRegion.deepCopy(),
                            getVertexBufferObjectManager()) {

                    @Override
                    protected void onManagedUpdate(float pSecondsElapsed) {

                            if (isMoveInside)
                                    ballSprite
                                                    .setAnchorCenterY(pAnchorCenterY -= (pSecondsElapsed * 0.25f));
                            super.onManagedUpdate(pSecondsElapsed);
                    }

            };
            ballSprite.setAnchorCenterY(pAnchorCenterY);
            wheelSprite.attachChild(ballSprite);

            ballSprite.registerEntityModifier(new LoopEntityModifier(
                            new RotationModifier(5f, 0f, 360f), 2,
                            new IEntityModifierListener() {

                                    @Override
                                    public void onModifierStarted(IModifier<IEntity> pModifier,
                                                    IEntity pItem) {
                                            isMoveInside = true;
                                    }

                                    @Override
                                    public void onModifierFinished(
                                                    IModifier<IEntity> pModifier, IEntity pItem) {
                                            isMoveInside = false;
                                    }
                            }));
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .