Android Open Source - BounceMe Wall






From Project

Back to project page BounceMe.

License

The source code is released under:

MIT License

If you think the Android project BounceMe listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.cse3345.f13.martin;
//w w w . ja va2 s.c o m
import android.graphics.Canvas;
import android.graphics.Paint;

public class Wall {
  private int top, bot, x, speed;
  private int width = 4;
  private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
  
  public Wall(int top, int bot, int x, int speed){
    this.top = top;
    this.bot = bot;
    this.x = x;
    this.speed = speed;
    paint.setColor(0x55000000);
  }
  
  public void draw(Canvas canvas){
    canvas.drawRect(x-width/2, top, x + width/2, bot, paint);
  }
  
  public boolean update(Ball ball){
    int rad = ball.getRadius();
    int left = ball.getX() - rad;
    int right = ball.getX() + rad;
    int ballTop = ball.getY() - rad;
    int ballBot = ball.getY() + rad;
    
    if(ballTop < bot && ballBot > top){
      if(right > x && left < x){
        ball.wallBounce();
      }
    }
    
    
    return true;
    
  }
}




Java Source Code List

com.cse3345.f13.martin.Ball.java
com.cse3345.f13.martin.CreditActivity.java
com.cse3345.f13.martin.Goal.java
com.cse3345.f13.martin.LevelGen.java
com.cse3345.f13.martin.LevelPicker.java
com.cse3345.f13.martin.Level.java
com.cse3345.f13.martin.MenuActivity.java
com.cse3345.f13.martin.PlaySurfaceView.java
com.cse3345.f13.martin.SetActivity.java
com.cse3345.f13.martin.Sling.java
com.cse3345.f13.martin.TutActivity.java
com.cse3345.f13.martin.Wall.java
com.cse3345.f13.martin.WinActivity.java
com.example.bounceme.Ball.java
com.example.bounceme.CreditActivity.java
com.example.bounceme.Goal.java
com.example.bounceme.GridAdapter.java
com.example.bounceme.Level.java
com.example.bounceme.MenuActivity.java
com.example.bounceme.PlaySurfaceView.java
com.example.bounceme.SetActivity.java
com.example.bounceme.Sling.java
com.example.bounceme.WinActivity.java
com.example.bounceme.levelGen.java
com.example.bounceme.levelPicker.java