Joomla Vorlagen by Website Hosting

PL1 - 3rd laboratory

Introduction

lab03.zip contains a skeleton of a simple simulation of something like a catapult: a ball is accelerated by a constant force and then it is running on ballistic trajectory as it is influenced by gravity force.

Packages

Separate project into packages:

  • pl1.common - classes that contains common used routines;
  • pl1.lab03 - classes that start application;
  • pl1.lab03.core -  classes implementing simulation.

Using libraries

Implement methods in the class Ball: move, accelerate.

Implement method in the class Catapult shootBall and in the class Physics manageBallMovement.

UML

pl1 03

Solution

lab003-02.zip

Homework

 Modify simulation:

  • When a ball hits left or right wall then it bounces according to the Law of Reflection.
  • Create some object (tree, house or whatever) on the random position at the bottom and blink with a canvas when a ball hits the object.