View previous topic :: View next topic
Author
Message
paupav Master Cheater
Reputation : 13 Joined: 15 Apr 2011 Posts: 314 Location: P. Sherman 42, Wallaby Way, Sydney
Posted: Sat Mar 29, 2014 12:29 pm Post subject: Paupav dogegame gameplay
Link
Source code:
Code: #include <iostream>
#include <SFML/Graphics.hpp>
#include <unistd.h>
int main()
{
sf::ContextSettings settings;
settings.antialiasingLevel = 16;
sf::RenderWindow window(sf::VideoMode(800, 600), "DogePav", sf::Style::Default, settings);
sf::Clock clock;
sf::Clock clock2;
sf::Clock clock3;
sf::Vector2i tripos(90, 310);
sf::Vector2i octpos(400, 400);
sf::Vector2i sqpos(650, 299);
sf::Vector2i collected(760, 20);
bool returning = false;
bool userControls = true;
float positionx = 10;
float positiony = 16;
sf::CircleShape triangle(20, 3);
sf::CircleShape square(20, 4);
sf::CircleShape octagon(20, 8);
sf::CircleShape shape(30, 999);
sf::Texture texture, texture2;
if(!texture.loadFromFile("texture.png"))
{
std::cout << "Could not load ball texture" << std::endl;
}
shape.setTexture(&texture);
//floor
sf::RectangleShape floor(sf::Vector2f(800, 60));
if(!texture2.loadFromFile("brick.png"))
{
std::cout << "Could not load floor texture" << std::endl;
}
floor.setTexture(&texture2);
floor.setPosition(0, 540);
octagon.setFillColor(sf::Color::Blue);
triangle.setFillColor(sf::Color::Yellow);
square.setFillColor(sf::Color::Magenta);
while(window.isOpen())
{
triangle.setPosition(tripos.x, tripos.y);
octagon.setPosition(octpos.x,octpos.y);
square.setPosition(sqpos.x,sqpos.y);
sf::Time borderBounce = clock3.getElapsedTime();
sf::Time time = clock.getElapsedTime();
sf::Time physic = clock2.getElapsedTime();
shape.setPosition(positionx, positiony);
if(!returning)
positiony = time.asMicroseconds() / 2319 + physic.asMilliseconds()/ 22;
while(positionx < 2)
positionx++;
while(positionx > 650)
positionx--;
if(positiony > 480)
returning = true;
if(returning )
{
positiony -=8;
clock.restart();
}
if(positiony < 15 + physic.asMilliseconds()/ 22)
returning = false;
if(physic.asSeconds() > 13)
{
clock.restart();
clock2.restart();
tripos.x = 90;
tripos.y = 310;
octpos.x = octpos.y = 400;
sqpos.x = 650;
sqpos.y = 299;
}
sf::Event event;
while(window.pollEvent(event))
{
switch(event.type)
{
case sf::Event::Closed:
window.close();
}
//collect triangle
std::cout << "Triangle pos: " << positionx << " " << positiony <<std::endl;
}
if( 120 > positionx && 60 < positionx && positiony > 280 && positiony < 340)
{
tripos.x = collected.x;
tripos.y = collected.y;
}
//collect oct
if( 430 > positionx && 370 < positionx && positiony > 370 && positiony < 430)
{
octpos.x = collected.x;
octpos.y = collected.y * 6 - 20;
}
//collect square
if( 680 > positionx && 620 < positionx && positiony > 269 && positiony < 329)
{
sqpos.x = collected.x;
sqpos.y = collected.y * 3;
}
if(userControls)
{
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
positionx += 5;
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
positionx -= 5;
std::cout.flush();
}
window.clear(sf::Color::White);
window.draw(shape);
window.draw(floor);
window.draw(octagon);
window.draw(triangle);
window.draw(square);
window.display();
window.setFramerateLimit(60);
}
}
Back to top
teeigeryuh Master Cheater
Reputation : 25 Joined: 13 Oct 2008 Posts: 262 Location: The netherlands
Posted: Sat Mar 29, 2014 12:35 pm Post subject: Re: Paupav dogegame gameplay
AWESOME GAMEPLAY BRO
DO I NEED GTX 1490XX FREEZE DARK SUPER COD YOLO EDITION TO PLAY IT????
I GOT DOES 16GB RAM SUPPORT IT?
_________________
ლ(╹◡╹ლ)
Back to top
Up2Admin I'm a spammer
Reputation : 126 Joined: 17 Oct 2007 Posts: 6548 Location: Texas
Posted: Sat Mar 29, 2014 1:31 pm Post subject:
Maybe if it didn't look so shit it would be better. Concept is nice I guess.
_________________
Back to top
paupav Master Cheater
Reputation : 13 Joined: 15 Apr 2011 Posts: 314 Location: P. Sherman 42, Wallaby Way, Sydney
Posted: Sat Mar 29, 2014 1:45 pm Post subject:
Up2Admin wrote: Maybe if it didn't look so shit it would be better. Concept is nice I guess.
you can put any pictures named "texture.png" and "brick.png"in the same folder as DogePav if that's what you mean.
Back to top
Fafaffy Cheater
Reputation : 65 Joined: 12 Dec 2007 Posts: 28
Posted: Sat Mar 29, 2014 2:17 pm Post subject:
>Dat gravity physics
_________________ Brillia wrote: I FUCKING FUCK SEX
Back to top
paupav Master Cheater
Reputation : 13 Joined: 15 Apr 2011 Posts: 314 Location: P. Sherman 42, Wallaby Way, Sydney
Posted: Sun Mar 30, 2014 6:12 am Post subject:
blablfy wrote: >Dat gravity physics
Don't physics include gravity?
Back to top