GE Zombie Sim

Started by: Cook | Replies: 250 | Views: 36,600

Devour
Administrator
1

Posts: 9,916
Joined: Apr 2008
Rep: 10

View Profile
Jan 29, 2012 1:56 AM #583138
I suggest there being a lot more (smaller) squares. It'd be a much more realistic way to organize and fit as many things in your pockets as possible. And it'd make things like gun cases possible, which would be good for holding weapons in, in good condition, rather than keeping them in a backpack.
Cook

Posts: 5,155
Joined: Nov 2009
Rep: 10

View Profile
Jan 29, 2012 1:58 AM #583143
Quote from Blue
For the inventory, should there be a feature where you could rotate objects? So if you had two L shaped items, you could rotate them to fit into a rectangle to save space.

Image

Anyhow, as the Regional Manager, I must report that lolipops, the Assistant to the Regional Manager has gone to sleep.

@Devy
Don't fucking attack me you nigger.
This is just a showcase. In the actual game, if this idea gets through, I was thinking about including the backpack spots, and then a few pocket slots like jean pockets or whatever.
Actually, depending on the bag, you could have multiple layers.
ChristianEater
2

Posts: 729
Joined: Mar 2011
Rep: 10

View Profile
Jan 29, 2012 2:11 AM #583165
I hear we need more programmers, so if you want to help out with the fun stuff, click the below link and download codeblocks. It is free.

http://www.codeblocks.org/downloads/26

Below is a basic 2D graphics engine. Gyoh and I are attempting to build our own, but this is a start. If you download codeblocks, (the above link) be sure to download the codeblocks version of the below link. Also free.

http://www.sfml-dev.org/download.php
lolipops
2

Posts: 383
Joined: Jan 2012
Rep: 10

View Profile
Jan 29, 2012 2:22 AM #583201
couldnt sleep, captain cock
ChristianEater
2

Posts: 729
Joined: Mar 2011
Rep: 10

View Profile
Jan 29, 2012 2:37 AM #583227
For you Gyoh.


////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include
#include
#include


////////////////////////////////////////////////////////////
/// Entry point of application
///
/// \return Application exit code
///
////////////////////////////////////////////////////////////
int main()
{
// Defines PI
const float PI = 3.14159f;

// Create the window of the application
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Pong");

// Load the sounds used in the game
sf::SoundBuffer BallSoundBuffer;
if (!BallSoundBuffer.LoadFromFile("datas/pong/ball.wav"))
{
return EXIT_FAILURE;
}
sf::Sound BallSound(BallSoundBuffer);

// Load the images used in the game
sf::Image BackgroundImage, LeftPaddleImage, RightPaddleImage, BallImage;
if (!BackgroundImage.LoadFromFile("datas/pong/background.jpg") ||
!LeftPaddleImage.LoadFromFile("datas/pong/paddle_left.png") ||
!RightPaddleImage.LoadFromFile("datas/pong/paddle_right.png") ||
!BallImage.LoadFromFile("datas/pong/ball.png"))
{
return EXIT_FAILURE;
}

// Load the text font
sf::Font Cheeseburger;
if (!Cheeseburger.LoadFromFile("datas/post-fx/cheeseburger.ttf"))
return EXIT_FAILURE;

// Initialize the end text
sf::String End;
End.SetFont(Cheeseburger);
End.SetSize(60.f);
End.Move(150.f, 200.f);
End.SetColor(sf::Color(50, 50, 250));

// Create the sprites of the background, the paddles and the ball
sf::Sprite Background(BackgroundImage);
sf::Sprite LeftPaddle(LeftPaddleImage);
sf::Sprite RightPaddle(RightPaddleImage);
sf::Sprite Ball(BallImage);

LeftPaddle.Move(10, (App.GetView().GetRect().GetHeight() - LeftPaddle.GetSize().y) / 2);
RightPaddle.Move(App.GetView().GetRect().GetWidth() - RightPaddle.GetSize().x - 10, (App.GetView().GetRect().GetHeight() - RightPaddle.GetSize().y) / 2);
Ball.Move((App.GetView().GetRect().GetWidth() - Ball.GetSize().x) / 2, (App.GetView().GetRect().GetHeight() - Ball.GetSize().y) / 2);

// Define the paddles properties
sf::Clock AITimer;
const float AITime = 0.1f;
float LeftPaddleSpeed = 400.f;
float RightPaddleSpeed = 400.f;

// Define the ball properties
float BallSpeed = 400.f;
float BallAngle;
do
{
// Make sure the ball initial angle is not too much vertical
BallAngle = sf::Randomizer::Random(0.f, 2 * PI);
} while (std::abs(std::cos(BallAngle)) < 0.7f);

bool IsPlaying = true;
while (App.IsOpened())
{
// Handle events
sf::Event Event;
while (App.GetEvent(Event))
{
// Window closed or escape key pressed : exit
if ((Event.Type == sf::Event::Closed) ||
((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)))
{
App.Close();
break;
}
}

if (IsPlaying)
{
// Move the player's paddle
if (App.GetInput().IsKeyDown(sf::Key::Up) && (LeftPaddle.GetPosition().y > 5.f))
LeftPaddle.Move(0.f, -LeftPaddleSpeed * App.GetFrameTime());
if (App.GetInput().IsKeyDown(sf::Key::Down) && (LeftPaddle.GetPosition().y < App.GetView().GetRect().GetHeight() - LeftPaddle.GetSize().y - 5.f))
LeftPaddle.Move(0.f, LeftPaddleSpeed * App.GetFrameTime());

// Move the computer's paddle
if (((RightPaddleSpeed < 0.f) && (RightPaddle.GetPosition().y > 5.f)) ||
((RightPaddleSpeed > 0.f) && (RightPaddle.GetPosition().y < App.GetView().GetRect().GetHeight() - RightPaddle.GetSize().y - 5.f)))
{
RightPaddle.Move(0.f, RightPaddleSpeed * App.GetFrameTime());
}

// Update the computer's paddle direction according to the ball position
if (AITimer.GetElapsedTime() > AITime)
{
AITimer.Reset();
if ((RightPaddleSpeed < 0) && (Ball.GetPosition().y + Ball.GetSize().y > RightPaddle.GetPosition().y + RightPaddle.GetSize().y))
RightPaddleSpeed = -RightPaddleSpeed;
if ((RightPaddleSpeed > 0) && (Ball.GetPosition().y < RightPaddle.GetPosition().y))
RightPaddleSpeed = -RightPaddleSpeed;
}

// Move the ball
float Factor = BallSpeed * App.GetFrameTime();
Ball.Move(std::cos(BallAngle) * Factor, std::sin(BallAngle) * Factor);

// Check collisions between the ball and the screen
if (Ball.GetPosition().x < 0.f)
{
IsPlaying = false;
End.SetText("You lost !\n(press escape to exit)");
}
if (Ball.GetPosition().x + Ball.GetSize().x > App.GetView().GetRect().GetWidth())
{
IsPlaying = false;
End.SetText("You won !\n(press escape to exit)");
}
if (Ball.GetPosition().y < 0.f)
{
BallSound.Play();
BallAngle = -BallAngle;
Ball.SetY(0.1f);
}
if (Ball.GetPosition().y + Ball.GetSize().y > App.GetView().GetRect().GetHeight())
{
BallSound.Play();
BallAngle = -BallAngle;
Ball.SetY(App.GetView().GetRect().GetHeight() - Ball.GetSize().y - 0.1f);
}

// Check the collisions between the ball and the paddles
// Left Paddle
if (Ball.GetPosition().x < LeftPaddle.GetPosition().x + LeftPaddle.GetSize().x &&
Ball.GetPosition().x > LeftPaddle.GetPosition().x + (LeftPaddle.GetSize().x / 2.0f) &&
Ball.GetPosition().y + Ball.GetSize().y >= LeftPaddle.GetPosition().y &&
Ball.GetPosition().y <= LeftPaddle.GetPosition().y + LeftPaddle.GetSize().y)
{
BallSound.Play();
BallAngle = PI - BallAngle;
Ball.SetX(LeftPaddle.GetPosition().x + LeftPaddle.GetSize().x + 0.1f);
}

// Right Paddle
if (Ball.GetPosition().x + Ball.GetSize().x > RightPaddle.GetPosition().x &&
Ball.GetPosition().x + Ball.GetSize().x < RightPaddle.GetPosition().x + (RightPaddle.GetSize().x / 2.0f) &&
Ball.GetPosition().y + Ball.GetSize().y >= RightPaddle.GetPosition().y &&
Ball.GetPosition().y <= RightPaddle.GetPosition().y + RightPaddle.GetSize().y)
{
BallSound.Play();
BallAngle = PI - BallAngle;
Ball.SetX(RightPaddle.GetPosition().x - Ball.GetSize().x - 0.1f);
}
}

// Clear the window
App.Clear();

// Draw the background, paddles and ball sprites
App.Draw(Background);
App.Draw(LeftPaddle);
App.Draw(RightPaddle);
App.Draw(Ball);

// If the game is over, display the end message
if (!IsPlaying)
App.Draw(End);

// Display things on screen
App.Display();
}

return EXIT_SUCCESS;
}
Cook

Posts: 5,155
Joined: Nov 2009
Rep: 10

View Profile
Jan 29, 2012 2:38 AM #583229
For now, the working title of this game is

​BOSTON Z PARTY
Devour
Administrator
1

Posts: 9,916
Joined: Apr 2008
Rep: 10

View Profile
Jan 29, 2012 2:43 AM #583238
Quote from Captain Cook
@Devy
Don't fucking attack me you nigger.


Wat. I was just trying to be helpful ;_;
lolipops
2

Posts: 383
Joined: Jan 2012
Rep: 10

View Profile
Jan 29, 2012 2:46 AM #583241
ill take a look ce
ChristianEater
2

Posts: 729
Joined: Mar 2011
Rep: 10

View Profile
Jan 29, 2012 2:48 AM #583243
Quote from Captain Cook
For now, the working title of this game is

​BOSTON Z PARTY


What about this?

The End of Z World
Cook

Posts: 5,155
Joined: Nov 2009
Rep: 10

View Profile
Jan 29, 2012 2:55 AM #583253
I mentioned Boston Z Party because if the game started in boston...

boston tea party

boston z party

huhehuehehhuehhh
Blue
2

Posts: 523
Joined: May 2010
Rep: 10

View Profile
Jan 29, 2012 2:55 AM #583254
Tea Parties in Boston all the way.
lolipops
2

Posts: 383
Joined: Jan 2012
Rep: 10

View Profile
Jan 29, 2012 2:58 AM #583259
captain cook stole my genius idea >=[
Cook

Posts: 5,155
Joined: Nov 2009
Rep: 10

View Profile
Jan 29, 2012 3:00 AM #583264
yeah, that was gyo's idea at first, lol.
ChristianEater
2

Posts: 729
Joined: Mar 2011
Rep: 10

View Profile
Jan 29, 2012 4:41 PM #583415
bump
lolipops
2

Posts: 383
Joined: Jan 2012
Rep: 10

View Profile
Jan 30, 2012 9:35 AM #583636
For ChristianEater: