Skip to content

Instantly share code, notes, and snippets.

@erlend-sh
Created December 10, 2012 18:23
Show Gist options
  • Save erlend-sh/4252302 to your computer and use it in GitHub Desktop.
Save erlend-sh/4252302 to your computer and use it in GitHub Desktop.
jMonkeyEngine: Beginner Test 4 Pulsing Solution
private boolean scale = true ;
float timePassed = 0.0f;
  
   /* This is the update loop */
   @Override
   public void simpleUpdate(float tpf)
   {
      timePassed+= tpf;
 
      if (timePassed >= 0.3 ){timePassed=0; scale=(!scale); } //change decrease/increase every 0.3 sec.
 
      float inc = 1+(0.50f * tpf);//50% increase/decrease per 0.3 sec.
 
      if (scale) player.scale(inc);
      else player.scale(1/inc);
   }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment