Showing posts with label breakout. Show all posts
Showing posts with label breakout. Show all posts

Wednesday, 11 June 2014

Break out game in C++ using QT 5.2.1 - Stage 1 - Header files

In his stage we were required to implement a bouncing ball inside a box. ball needs to bounce of the box edges at constant speed. singleton design pattern used here. this is done in QT. we have header and implementation files for coordinate, ball, and dialog classes, in addition to main method.
here is the coordinate header file...coordinate.h...

ball.h
dialog.h

sample config file looks like this

now some explanation. coordinate class is for translating coordinate in Qt in a way that we are comfortable of. it means Qt consider top left corner (0,0), and while you're moving to right or down it increases the x and y coordinate. personally, I think we don't need this..well...here it is... ball class has some functions needs proper implementation beside normal getter/setter methods. render and isCollision functions. isCollision function checks if the ball hit any edges of the box, and render function handle the ball movements. dialog class is the core of this to put them all together. we used Singleton Design Pattern here to make sure only one instance of dialog exists at any time. I hope I explained it good enough, as I'm still learning. I'll post the implementation files and main method in near future, meanwhile stay hungry, keep coding

Some other information:

  • this is not my code. mine was similar but it didn't changed colour when ball hits the box
  • again this is implemented in Qt
  • the actual website that have the tutorial on basic set up to start on this assignment can be found Here

Friday, 6 June 2014

Break out game in C++ using QT 5.2.1 - Introduction

I had an assignment this semester which was about to create BreakOut game using C++ and Qt IDE. it was part of INFO3220 - Object Oriented Design subject which is offered in prestigious university of Sydney...where recently its e-learning website known as BlackBoard crashed....assignment was in 3 stages and it needed to be done individually.
stages are:
  1. bouncing ball inside a box in a constant speed, and specification of ball and box needs to be read from a file.
  2. lay out bricks with initial health. ball should hit them and based on the bricks health, it should behave accordingly, either bounce back or remove brick.
  3. add paddle at the bottom, ball needs to bounce back from that, and paddle needs to be controlled either by mouse or keyboard. shows players life and score.
I post the source code little by little, and I'll do my best to explain them. the code which I will use is not mine. we implemented the first stage then we for later stages we got a sample code for former stage and developed that to add additional features. the sole purpose of this is to give students the chance to have sample to work out and see how they need to do stuff. I'm not seeking no any intention whatsoever to get benefit from that. I thought about considering copyright of the person who wrote the code, I'm not sure if this cause any problem or any ethic issue. All rights reserved for INFO3220 teaching staff.
I'll post the code as soon as I get time...considering exams are coming...

I also try to put rest of assignments and task for other subjects hopefully. this might take time to organise them, so stay tuned
Pamador out