Game Development Reference
In-Depth Information
class B:A
{
public int var4;
private int var5;
public void MethodInB()
{
...
}
}
(a) Indicate if the following expressions are allowed in MethodInA :
this .var1
this .var2
this .var3
this .var4
this .Var2
base .var1
(b) Indicate if the following expressions are allowed in MethodInB :
this .var1
this .var2
this .var3
this .var5
this .Var2
base .var1
base .var2
base .var3
base .Var2
9. Type checking
Are the types of expressions checked during the compilation phase, or when the
program is running? There is a exception to this rule. In which case is this? And
why is that exception necessary?
Challenges
1. More flying balloons
This challenge uses the Balloon2 program from Chap. 5 as a basis.
(a) Modify the program so that the balloon follows the mouse pointer, but with
a delay. Hint: add a balloon velocity vector to the program, and change the
velocity depending on the distance of the balloon to the mouse pointer.
(b) Modify the program so that the balloon cannot fly outside of the screen. Take
into account the width and height of the sprite.
(c) Change the program so that the balloon flies in circles around a point moving
from the left to the right.
(d) Add a few flying balloons (in any direction you like) that bounce off the
edges of the screen. Use the if -instruction to reverse their velocities.
2. Extending the Painter game
This challenge uses the Painter game as a basis.
Search WWH ::




Custom Search