Digital
and Interactive Games 2015, Term 2, Week 9, Session 1
Mastermind continued
Today:
int correctPlace = 0;
int correctColour = 0;
if new(i) = puzzle(i)
correctPlace++;
http://i483.photobucket.com/albums/rr193/Brenorenz/W17001_zpsdsllhcqn.png
Square.cpp
#include "Square.h"
Square::Square()
{
DrawingObject::DrawingObject();
}
void Square::setUp(float size, ID2D1SolidColorBrush* brush) {
this->size = size;
setLocation(halfSize, halfSize);
setBrush(brush);
setActive(true);
}
void Square::setLocation(float x, float y) {
location.x = x;
location.y = y;
rect = D2D1_RECT_F(/*
D2D1::Point2F(location.x, location.y),
location.x - halfSize, location.y - halfSize, location.x + halfSize, location.y + halfSize*/
);
}
void Square::update(GameTime gameTime) {
velocity.setX(velocity.getX() + getAccelerationX());
velocity.setY(velocity.getY() + getAccelerationY() + getGravity());
setLocation(static_cast<float>(location.x + velocity.getX() * static_cast<float>(gameTime.getElapsedTime())),
static_cast<float>(location.y + velocity.getY() * static_cast<float>(gameTime.getElapsedTime())));
}
void Square::draw(ID2D1HwndRenderTarget* renderingTarget) {
renderingTarget->DrawRectangle(rect, brush, strokeWidth);
renderingTarget->FillRectangle(rect, brush);
}
Square::~Square()
{
}
BaseApp.h
#include “Square.h”
Mastermind.java
image.Background
background = new image(“media/Mastermind 002.png”)
#cplusplus #gamedesign #gameprogramming #java #mastermind #programming #tafe
Mastermind continued
Today:
int correctPlace = 0;
int correctColour = 0;
if new(i) = puzzle(i)
correctPlace++;
http://i483.photobucket.com/albums/rr193/Brenorenz/W17001_zpsdsllhcqn.png
Square.cpp
#include "Square.h"
Square::Square()
{
DrawingObject::DrawingObject();
}
void Square::setUp(float size, ID2D1SolidColorBrush* brush) {
this->size = size;
setLocation(halfSize, halfSize);
setBrush(brush);
setActive(true);
}
void Square::setLocation(float x, float y) {
location.x = x;
location.y = y;
rect = D2D1_RECT_F(/*
D2D1::Point2F(location.x, location.y),
location.x - halfSize, location.y - halfSize, location.x + halfSize, location.y + halfSize*/
);
}
void Square::update(GameTime gameTime) {
velocity.setX(velocity.getX() + getAccelerationX());
velocity.setY(velocity.getY() + getAccelerationY() + getGravity());
setLocation(static_cast<float>(location.x + velocity.getX() * static_cast<float>(gameTime.getElapsedTime())),
static_cast<float>(location.y + velocity.getY() * static_cast<float>(gameTime.getElapsedTime())));
}
void Square::draw(ID2D1HwndRenderTarget* renderingTarget) {
renderingTarget->DrawRectangle(rect, brush, strokeWidth);
renderingTarget->FillRectangle(rect, brush);
}
Square::~Square()
{
}
BaseApp.h
#include “Square.h”
Mastermind.java
image.Background
background = new image(“media/Mastermind 002.png”)
#cplusplus #gamedesign #gameprogramming #java #mastermind #programming #tafe
No comments:
Post a Comment