Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - C++Geek

Pages: [1]
1
SFML projects / Re: Squid Blaster
« on: March 21, 2016, 11:26:18 pm »
Ah, you found the bottom to top thing. That does make the game a lot easier, I'm working on a way to fix it, but I need to keep it for now because every minute, one squid is added to the wave's "weak spot", so after ten minutes the game would become impossible without bottom to top teleportation.

Whoops, I guess I wasn't clear on the hovering bit. I mean the turtle has to touch the fish for a few seconds. I'll update the readme. Thank you for bringing this to my attention!

And thanks for the example graphics. I'll see what I can do.

Huh. I wasn't using the image boundaries for the turtle's bounding box, so it must be something else. Here's my code:

switch (this->direction)
        {
        case UP:
                this->bounds = FloatRect(this->sprite.getPosition().x - 21, this->sprite.getPosition().y - 31, 40, 52);
                break;
        case DOWN:
                this->bounds = FloatRect(this->sprite.getPosition().x - 19, this->sprite.getPosition().y - 21, 40, 52);
                break;
        case LEFT:
                this->bounds = FloatRect(this->sprite.getPosition().x - 31, this->sprite.getPosition().y - 19, 52, 40);
                break;
        case RIGHT:
                this->bounds = FloatRect(this->sprite.getPosition().x - 21, this->sprite.getPosition().y - 21, 52, 40);
                break;
        };

2
SFML projects / Re: Squid Blaster
« on: March 18, 2016, 05:10:10 pm »
Ah, I should have figured that one out myself, now I feel dumb. Thanks!  :P

3
SFML projects / Re: Squid Blaster
« on: March 18, 2016, 02:45:34 am »
Thank you for your comments. Those are some good ideas!

Could you explain the hitbox error a little more? Did the squid bump into you, or did you bump into the squid? Can you reproduce the problem? Thank you for your time.

As for moving diagonally, how would you suggest implementing it? There are four arrow keys, so what would your recommendation be?

As for graphics, I forgot to explain this, but I had intended for it to be a little more like retro pixel art. At first the game was a Space Invaders clone (hence "Squid Blaster"), but it evolved rather quickly away from that. However, I always resort to pixel art style games because I make my graphics with Paint, and I have no idea how to make smooth graphics like in most games. If you could link me to a tutorial or program to make good art, that would be much appreciated.  ;D

4
SFML projects / Squid Blaster
« on: March 17, 2016, 02:48:23 am »
So, this is a game that I have been working on for a while, and now that it's to version 2.0, I figured it was worthy to be posted on this forum.  ;)

I used SFML for just about everything, the rendering, the bounding boxes, etc. I just created my own classes to represent the game world.

The point of the game is to destroy the army of oncoming squid. You control a turtle that can belch out fireballs. The goal is to get as many points as possible, and survive as long as possible. There are bosses, giant fireballs, and fish, so enjoy!  ;D
This game has a pixel art graphics style. There are two main strategies you can go for: the best time and the high score. To go for the best time, you target the weak spots in the waves of squids, and basically survive as long as possible. To go for the high score, you destroy as many squids as you can, so you can rack up as many points as possible.

P.S. It only runs on Windows. I tested with Windows 7/10

The start of the game.
(click to show/hide)

A scary boss!
(click to show/hide)

View my code here: https://github.com/TheArduinist/Squid-Blaster.git
Download the executable here: https://www.dropbox.com/sh/voy1fxerr3nj56n/AADczvOvXBfwGbYfdgawS_wba?dl=1

Any suggestions are welcome! I'm a young programmer, so I'd be happy to hear an expert's opinion!

5
Graphics / Re: Transparent Image Help
« on: May 15, 2015, 09:41:10 pm »
Quote
Does it load now?

Yes it does. Thanks!

6
Graphics / Re: Transparent Image Help
« on: May 15, 2015, 08:41:07 pm »
Quote
Here's a transformed version:

How did you do that?

7
Graphics / Transparent Image Help
« on: May 15, 2015, 07:32:51 pm »
Hello!

I would like to use SFML to display a partially transparent PNG image.
The one called "shape.png" works fine.
The one called "arrow.png" fails to load.

What is wrong with arrow.png?

8
Graphics / Re: loadFromFile() Function Creates Exception
« on: May 12, 2015, 08:35:54 pm »
All right. Thanks so much!  ;D

9
Graphics / Re: loadFromFile() Function Creates Exception
« on: May 12, 2015, 06:40:14 pm »
Silly mistake by me! I had my build config set to debug. I changed the .lib files to the sfml-xxx-d.lib files, and it worked! But now, when I resize the window, the sprite stretches or shrinks, depending on the window size. Is there any way to fix that?

10
Graphics / Re: loadFromFile() Function Creates Exception
« on: May 12, 2015, 06:06:59 pm »
I am using version 2.2. I'll try doing the linking over again and see if that works.

11
Graphics / loadFromFile() Function Creates Exception
« on: May 08, 2015, 11:55:06 pm »
Hello!

I have downloaded SFML for my Visual C++ 2010 Express, and all works as expected... until I try to use the sf::Texture loadFromFile() function! Here is my code:

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "Here is a shape:");
    sf::Texture texture;

        if (!texture.loadFromFile("shape.png"))
                return -1;

        sf::Sprite sprite(texture);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(sprite);
        window.display();
    }

    return 0;
}

This is what a message box says when I try to run the code (sfml.exe is my app's name):

Unhandled exception at 0x73231f34 in sfml.exe: 0xC0000005: Access violation reading location 0x00361000.

Pages: [1]