Commit 7ff47871 authored by ktsiam's avatar ktsiam
Browse files

fixed 1 bug

parent b05c7b5f
File deleted
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.a.out</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
......@@ -32,7 +32,6 @@ struct State {
}
State() { reset(); }
#define MAX(x,y) x < y ? y : x; // y if x < y
void update(int input) { // -1 => LEFT, 1 => RIGHT, 0 => WAIT
// player move
......@@ -46,7 +45,7 @@ struct State {
ball_p[1] += ball_v[1];
// horizontal collision
if (ball_p[0] < 0 or ball_p[0] > WIDTH)
if (ball_p[0] <= 0 or ball_p[0] >= WIDTH)
ball_v[0] = -ball_v[0];
// top collision
......@@ -60,6 +59,7 @@ struct State {
ball_v[1] = -ball_v[1];
else {
reset(); // game over
assert(false && "END");
return;
}
}
......@@ -73,7 +73,7 @@ struct State {
x_interval[0] = (i % BRICK_COLS) * BRICK_SIZE;
x_interval[1] = x_interval[0] + BRICK_SIZE;
y_interval[0] = (i / BRICK_COLS) * BRICK_SIZE + BRICK_MIN_HEIGHT;
y_interval[0] = (i / BRICK_COLS) * BRICK_SIZE; // + BRICK_MIN_HEIGHT;
y_interval[1] = y_interval[0] + BRICK_SIZE;
if (ball_p[0] < x_interval[0] or
......@@ -81,7 +81,6 @@ struct State {
ball_p[1] < y_interval[0] or
ball_p[1] > y_interval[1])
continue; // no collision
else {
bricks[i] = false;
......
#!/bin/bash
clang++ -std=c++14 brick-breaker.cpp
./a.out
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment