Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6770853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:21:47+00:00 2026-05-26T15:21:47+00:00

I’m implementing a board game for a course I’m taking. There are 5 racks

  • 0

I’m implementing a board game for a course I’m taking. There are 5 “racks” (ImageViews), 1 for each of 5 players. The way I wish to show the current player is to have their rack “highlighted” (achieved through setting the alpha value). Now, this could be done successfully by just calling the setAlpha method, but it’s a little jarring to go straight from one to the other, so i’d like to use an alpha animation. My issue is that, when the current player switches, I want to dim the highlighted rack, and highlight the next rack. It does this fine with those two racks, but in addition, every OTHER rack does a “dim”, in that it immediately brightens and slowly dims back down. Makes the game look rather bizarre. So the two that I want to change are changing correctly, but all the others should just stay dim. I have the following code set up for it:

dim.xml:

<?xml version="1.0" encoding="utf-8"?>
<alpha
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromAlpha="0.75"
    android:toAlpha="0.5"
    android:duration="1000"/>

highlight.xml:

<?xml version="1.0" encoding="utf-8"?>
<alpha
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromAlpha="0.5"
    android:toAlpha="0.75"
    android:duration="1000"/>

dim and highlight methods:

dim = AnimationUtils.loadAnimation(gui, R.anim.dim); dim.setFillAfter(true);
highlight = AnimationUtils.loadAnimation(gui, R.anim.highlight); highlight.setFillAfter(true);

public Runnable dim(final Player player) {
    return new Runnable() {
          public void run () {
              dim.reset();
              player.getRack().clearAnimation();
              player.getRack().startAnimation(dim);
              //player.getRack().setAlpha(128);
              continuation();
          }
        };
}

public Runnable highlight(final Player player) {
    return new Runnable() {
          public void run () {
              highlight.reset();
              player.getRack().clearAnimation();
              player.getRack().startAnimation(highlight);
              //player.getRack().setAlpha(192);
              continuation();
          }
        };
}

The places it’s called (denoted by asterisks):

public void setup() {
    int starting = (int)(Math.random()*players.size());
    curPlayer = players.get(starting);
    observer.execute(
    *** observer.dim(players.get(0)),
    *** observer.dim(players.get(1)),
    *** observer.dim(players.get(2)),
    *** observer.dim(players.get(3)),
    *** observer.dim(players.get(4)),
    *** observer.highlight(curPlayer)
    );
}

public void draw() {
    if(deck.isEmpty()) {
        //Game over
        return;
    }
    Question q = deck.pop();
    String answer = q.answer(curPlayer);
    answers.add(answer);
    Player oldPlayer = curPlayer;
    curPlayer = players.get((curPlayer.getPlayerNum() + 1)%players.size());
    observer.execute(
        observer.ask(q.getQuestionText()),
        observer.say(answer),
    *** observer.dim(oldPlayer),
    *** observer.highlight(curPlayer)
    );
}

Any ideas??? I’m hitting a wall with this and can’t seem to find an answer anywhere. Sorry for the large amount of code!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T15:21:48+00:00Added an answer on May 26, 2026 at 3:21 pm

    I’m not familiar with the observer classes you’re using. Try 2 things:

    1) Re-load your animations on each dim/highlight call.
    2) Try without observer in draw (explicitly call startAnimation).

    I’m assuming the observer class is going what it appears to be doing, and #2 won’t make a difference, but its something to try. If you’re using observer to allow those operations to be called in the UI thread, create/use a Handler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.