Download Computer-Aided Catalan Learning Application
Transcript
Computer-Aided Catalan Learning Application - Implementation and technical issues
DrawScene ds = new HouseScene();
while(true){
ds.updateEntities();
[PREPARE OPENGL]
ds.sortEntities();
ds.drawEntities();
}
sleep(animationSpeed*1000);
Code 7: Pseudo code of the rendering loop
4.2.4.4 The difference object
In order to determine where the user can and where he can't move to, a very simple
method has been used. For each scene a difference image was created. A difference
image is an image composed of only two colors, red and black. The red parts determine
where the user can move, and the black parts determine 'forbidden' zones. This image is
actually scaled down to ¼ of the actual scene size, so that to work out if a zone is allowed,
you just need to have its coordinates, scale them and then check the colour in the
difference image. If this colour is red, the movement is allowed. Otherwise, the character
must stop.
Figure 10: Outside scene background and its difference image
- 54 -