added gate locker [WIP] - train development
This commit is contained in:
parent
611d08fdef
commit
cd80d8f4c8
BIN
Pinball.g3a
BIN
Pinball.g3a
Binary file not shown.
|
@ -10,4 +10,4 @@ Started Saturday May 27th 2023 6pm and to be done by Saturday June 3rd 2023 6pm.
|
|||
|
||||
Let see how far we can go in one single week to create a Pinball Game ...
|
||||
|
||||
![](fxlink-image-2023.05.30-21h28-1.png)
|
||||
![](https://www.planet-casio.com/storage/staff/PinballAbyss.png)
|
||||
|
|
41
src/main.cpp
41
src/main.cpp
|
@ -74,18 +74,12 @@ uint16_t CY(Vector2D pos) {
|
|||
/* create the pinball board */
|
||||
void SetupScene(int which_table) {
|
||||
|
||||
if (which_table == 0)
|
||||
Setup_Table_0();
|
||||
else if (which_table == 1)
|
||||
Setup_Table_1();
|
||||
else if (which_table == 2)
|
||||
Setup_Table_2();
|
||||
else if (which_table == 3)
|
||||
Setup_Table_3();
|
||||
else if (which_table == 4)
|
||||
Setup_Table_4();
|
||||
else
|
||||
Setup_Table_0();
|
||||
if (which_table == 0) Setup_Table_0();
|
||||
else if (which_table == 1) Setup_Table_1();
|
||||
else if (which_table == 2) Setup_Table_2();
|
||||
else if (which_table == 3) Setup_Table_3();
|
||||
else if (which_table == 4) Setup_Table_4();
|
||||
else Setup_Table_0();
|
||||
}
|
||||
|
||||
void HandleBallBallCollision(Ball *ball1, Ball *ball2) {
|
||||
|
@ -303,6 +297,10 @@ static void update(float dt) {
|
|||
libnum::num(0.01));
|
||||
}
|
||||
|
||||
/* Check for collision with the pinball entry locker borders */
|
||||
if (MyPinball.has_locker && MyPinball.locker_is_enabled)
|
||||
HandleBallIslandCollision(&MyPinball.balls[i], MyPinball.locker, libnum::num(0.01));
|
||||
|
||||
/* Check for collision with flippers */
|
||||
for (int j = 0; j < MyPinball.flippers.size(); j++)
|
||||
HandleBallFlipperCollision(&MyPinball.balls[i], MyPinball.flippers[j]);
|
||||
|
@ -322,11 +320,24 @@ static void render(void) {
|
|||
MyPinball.sideimage, DIMAGE_NONE);
|
||||
|
||||
int mod = MyPinball.borders.size();
|
||||
for (int i = 0; i < MyPinball.borders.size(); i++)
|
||||
for (int i = 0; i < mod; i++)
|
||||
azrp_line(CX(MyPinball.borders[i]), CY(MyPinball.borders[i]),
|
||||
CX(MyPinball.borders[(i + 1) % mod]),
|
||||
CY(MyPinball.borders[(i + 1) % mod]), C_WHITE);
|
||||
|
||||
if (MyPinball.has_locker)
|
||||
{
|
||||
int modZ = MyPinball.locker.size();
|
||||
for (int i = 0; i < modZ; i++)
|
||||
azrp_line(CX(MyPinball.locker[i]), CY(MyPinball.locker[i]),
|
||||
CX(MyPinball.locker[(i + 1) % modZ]),
|
||||
CY(MyPinball.locker[(i + 1) % modZ]), MyPinball.locker_is_enabled ? C_WHITE : RGB565_BLOODYRED );
|
||||
|
||||
azrp_circle(CX(MyPinball.Locker_enabler.pos), CY(MyPinball.Locker_enabler.pos),
|
||||
(int)(MyPinball.Locker_enabler.radius * cScale),
|
||||
MyPinball.Locker_enabler.color);
|
||||
}
|
||||
|
||||
for (int i = 0; i < MyPinball.obstacles.size(); i++)
|
||||
azrp_filledcircle(CX(MyPinball.obstacles[i].pos),
|
||||
CY(MyPinball.obstacles[i].pos),
|
||||
|
@ -451,6 +462,10 @@ static void get_inputs(float dt) {
|
|||
SetupScene(4);
|
||||
}
|
||||
|
||||
if (MyKeyboard.IsKeyReleasedEvent(MYKEY_VARS) && MyPinball.has_locker)
|
||||
{
|
||||
MyPinball.locker_is_enabled = !MyPinball.locker_is_enabled;
|
||||
}
|
||||
|
||||
#if (DEBUG_MODE)
|
||||
if (MyKeyboard.IsKeyPressed(MYKEY_OPTN) &&
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
this->color = color;
|
||||
this->points = points;
|
||||
}
|
||||
|
||||
~Obstacle() {}
|
||||
Obstacle() {}
|
||||
|
||||
libnum::num32 radius, pushVel;
|
||||
|
@ -70,7 +70,16 @@ public:
|
|||
this->points = points;
|
||||
}
|
||||
|
||||
void Set( Target t )
|
||||
{
|
||||
this->radius = t.radius;
|
||||
this->pos = t.pos.Clone();
|
||||
this->color = t.color;
|
||||
this->points = t.points;
|
||||
}
|
||||
|
||||
Target() {}
|
||||
~Target() {}
|
||||
|
||||
libnum::num32 radius;
|
||||
Vector2D pos;
|
||||
|
|
13
src/tables.h
13
src/tables.h
|
@ -395,6 +395,19 @@ void Setup_Table_4(void) {
|
|||
MyPinball.borders.push_back( Vector2D(libnum::num32(0.26), libnum::num32(0.02)));
|
||||
MyPinball.borders.push_back( Vector2D(libnum::num32(0.74), libnum::num32(0.02)));
|
||||
|
||||
MyPinball.has_locker = true;
|
||||
MyPinball.locker.clear();
|
||||
MyPinball.locker.push_back( Vector2D(libnum::num32(0.90), libnum::num32(1.46)));
|
||||
MyPinball.locker.push_back( Vector2D(libnum::num32(1.11), libnum::num32(1.20)));
|
||||
MyPinball.locker.push_back( Vector2D(libnum::num32(1.11), libnum::num32(1.10)));
|
||||
MyPinball.locker.push_back( Vector2D(libnum::num32(1.04), libnum::num32(1.10)));
|
||||
MyPinball.locker.push_back( Vector2D(libnum::num32(0.98), libnum::num32(1.10)));
|
||||
MyPinball.locker.push_back( Vector2D(libnum::num32(0.98), libnum::num32(1.20)));
|
||||
MyPinball.locker.push_back( Vector2D(libnum::num32(0.96), libnum::num32(1.34)));
|
||||
MyPinball.locker_is_enabled = false;
|
||||
// Target MyTarget( 0.06, Vector2D(libnum::num32(0.90), libnum::num32(1.40)), RGB565_APPLEGREEN, 0);
|
||||
// MyPinball.Locker_enabler.Set( MyTarget );
|
||||
|
||||
MyPinball.balls.clear();
|
||||
libnum::num32 ball_radius = libnum::num32(0.03);
|
||||
libnum::num32 ball_mass = libnum::num32(PI) * ball_radius * ball_radius;
|
||||
|
|
Loading…
Reference in New Issue