public class

BreakoutScreen

extends ShapeScreen
java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.view.ContextThemeWrapper
         ↳ android.app.Activity
           ↳ sofia.app.Screen
             ↳ sofia.app.ShapeScreen
               ↳ sofia.demos.breakout.BreakoutScreen

Class Overview

An implementation of the classic Breakout game, using Sofia shapes, animation, and collision detection.

Summary

[Expand]
Inherited Constants
From class android.app.Activity
From class android.content.Context
[Expand]
Inherited Fields
From class android.app.Activity
Public Constructors
BreakoutScreen()
Public Methods
void initialize()
Initializes the shapes for the game.
void onCollisionBetween(Ball theBall, ViewEdges edges)
Called when the ball has collided with bottom edge of the view, to subtract a life from the player.
void onCollisionBetween(Ball theBall, Brick brick)
Called when the ball has collided with a brick to update the score.
void onTouchDown(MotionEvent e)
Moves the paddle when the user touches down on the screen.
void onTouchMove(MotionEvent e)
Moves the paddle when the user moves his or her finger on the screen.
[Expand]
Inherited Methods
From class sofia.app.ShapeScreen
From class sofia.app.Screen
From class android.app.Activity
From class android.view.ContextThemeWrapper
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.view.KeyEvent.Callback
From interface android.view.LayoutInflater.Factory
From interface android.view.View.OnCreateContextMenuListener
From interface android.view.Window.Callback
From interface sofia.app.ScreenMethods

Public Constructors

public BreakoutScreen ()

Public Methods

public void initialize ()

Initializes the shapes for the game.

public void onCollisionBetween (Ball theBall, ViewEdges edges)

Called when the ball has collided with bottom edge of the view, to subtract a life from the player. If any of the other edges are hit, then that handling occurs in the Ball class itself.

Parameters
theBall the ball that collided
edges the view edges that were involved in the collision

public void onCollisionBetween (Ball theBall, Brick brick)

Called when the ball has collided with a brick to update the score. The changing of the ball's velocity actually occurs in the Ball class itself.

Parameters
theBall the ball that collided
brick the brick that collided

public void onTouchDown (MotionEvent e)

Moves the paddle when the user touches down on the screen.

Parameters
e the motion event

public void onTouchMove (MotionEvent e)

Moves the paddle when the user moves his or her finger on the screen.

Parameters
e the motion event