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 - bitano

Pages: 1 2 3 [4] 5 6
46
SFML game jam / Re: 5th SFML Game Jam
« on: March 21, 2016, 04:02:23 pm »
I'd have gone for a game where you can get penalized for certain actions.

When you're game over, the game wouldn't just have a HIGH score with a top 10 in which you can register your new highscore, but underneath it there would also be a LOW score with a bottom 10.

You could go for as many penalties as possible to try and get the lowest score on the list, earning you the title of Master Loser /flex.

--------------

Sadly i noticed the event too late and therefore didn't have enough time to compete :D.
But i still get to vote, right? RIGHT ?!

47
Graphics / Re: [Beginner] Snake game, please help.
« on: March 21, 2016, 02:04:06 pm »
It may be better to use a std::deque instead of a std::vector for this
Oh hey... There's something new i've learned about then. Convenient! :D

48
Window / Re: Textbox in Window
« on: March 20, 2016, 08:54:42 am »
Well...it's quite tricky really without knowing the full code and implementation.

I have a similar GUI class which stores a reference to all created objects in vector arrays.
When the mouse is moved or buttons are clicked, the vector arrays are consulted to determine whether the mouse is on top of any of the gui objects.

If so, i store a reference to the item in my GUI's hoverItem struct. On a mouseclick the hoverItem is activated and set as a reference in a selectedItem struct.

When typing, the TextEntered event passes the text to the GUI text handler which consults the selectedItem struct. If it's a textfield, that textfield's text variable is updated with the typed text.

49
Window / Re: Textbox in Window
« on: March 19, 2016, 11:04:22 pm »
In my event polling part i have something looking like this at the moment. It does its work nicely:

    while(this->window.pollEvent(event)) {
        switch(event.type) {
            case sf::Event::TextEntered:
                if (gui.selectedItem.type == GUI_TEXTFIELD) {
                    gui.handleTextEntered(event.text.unicode);
                }
                break;
        }
    }
 

And then in my gui class the handleTextEntered function looks a bit like this:

void GuiClass::handleTextEntered(sf::Uint32 key) {
    if (key >= 128 || key ==  27 || key == 13) return;
    if (key ==   8) {
        if (wins[selectedItem.win].textfields[selectedItem.nr].text != "")
            wins[selectedItem.win].textfields[selectedItem.nr].text.erase(wins[selectedItem.win].textfields[selectedItem.nr].text.getSize()-1, 1);
        return;
    }
    if (selectedItem.type == GUI_TEXTFIELD) {
        wins[selectedItem.win].textfields[selectedItem.nr].text += static_cast<char>(key);
    }
}
 

It's a bit crude and requires an overhaul, but it does the job.

50
Window / Re: Textbox in Window
« on: March 19, 2016, 10:45:00 pm »
Also sounds like you're looking for something like SFGUI (?)

51
General / Re: Snake Game[In progress]
« on: March 19, 2016, 08:10:17 pm »
Since it's a snake game, i'd think it unnecessary to use a vector for Fruit as 1 fruit is spawned at a time and the next is only spawned when the current is reached.
At least, that's the snake game i know :D.

Ignore this if the change in gameplay is intended.

52
Graphics / Re: [Beginner] Snake game, please help.
« on: March 19, 2016, 03:47:19 pm »
Do you think there's something else better for a beginner bitano? I've been searching for suggestions but couldn't find except this and pong.Thank you !
Oh no i think Snake is fine! Just don't try to complete the game as fast as possible, but handle 1 challenge at a time :D and try to understand what's going on before moving to the next part :D

For instance, i think the next step might be for you to try and move the snake square around like in the snake game. Don't worry about anything else until that's working

53
Graphics / Re: [Beginner] Snake game, please help.
« on: March 19, 2016, 03:20:37 pm »
I'm still making the game bitano, still didn't add the motion stuff, anyway thanks for the tips!
I realize that. But the way i see it, you don't have to worry yet about the snake growing or the fruit changing position before you get the input handling and snake movement right.

But maybe that's just me. Again, good luck!  ;D

Here's a small improvement on your event loop (you could ofc use enums for the direction instead of short values to make it more readable):

        // INPUT
        sf::Event event;
        while (window.pollEvent(event)) {
            switch(event.type) {
                case sf::Event::Closed:
                    window.close();
                    break;
                case sf::Event::KeyPressed:
                    switch (event.key.code) {
                        case sf::Keyboard::Escape: window.close();   break;
                        case sf::Keyboard::Up:     snakeDir = 0;     break;
                        case sf::Keyboard::Down:   snakeDir = 1;     break;
                        case sf::Keyboard::Left:   snakeDir = 2;     break;
                        case sf::Keyboard::Right:  snakeDir = 3;     break;
                        default: break;
                    }
                    break;
                default: break;
            }
        }
 

54
Graphics / Re: [Beginner] Snake game, please help.
« on: March 19, 2016, 02:42:08 pm »
Lol To be fair, you're pretty much asking others to make the whole game for you :D

It's not just about the snake growing or the fruit changing position, but also:

1. the keypresses aren't properly read
2. there's nothing in place to make the snake move
3. there's this addsnake class / struct in your code but it doesn't exist.

Not flaming you at all, but it seems you're trying to fly when you have to learn to walk first.
Here are some tips based on how i would make a first snake game:

1. Don't use 4 black sf::rectangleShapes to make a border. just clear the window using black color and then use a single sf::rectangleShape to draw the cyan playField.

2. Since the snake and the fruit are 20x20 squares, don't think of the playfield as a 400x400 square, but instead as a grid of 20x20 positions.

3. Use a separate function createFruit() which randomly determines a new location for the fruit to be created. Pass the snake vector array to this function so that the function can check whether the new fruit is sharing a spot with a snake tailpiece - if so, find a new spot. The function then returns the randomly generated grid position x and y of the fruit which you keep in a variable.

4. Use a vector array to keep track of each bodypart of the snake. Whenever the snake moves, loop through the vector to determine the new position of each tailpiece based on the previous tailpiece.

5. Add an sf::clock to the game and check for the elapsed time. Use a speed variable and determine at which elapsed time amount you want to update the snake's position (thus determining the game speed)

6. When the snake moves, make several checks on the first vector array record (the head).
    - if its grid position equals that of the fruit, call the createFruit() function (and increase a score variable by 1)
    - if its grid position equals that of a tailpiece, it's game over
    - if its grid position is lower or higher than the amount of available grid positions, it's game over

Don't try to build Snake in 1 go. Read some SFML documentation on events, sf::Clock, vectors, etc. Just focus on parts of the game and get those to work first (keyboard input, snake head movement). Then when you figured each part out, combine them and you build your very own game.

Good luck!

55
General / Re: Mouse isButtonReleased
« on: March 19, 2016, 12:10:40 am »
If a button isn't pressed, it is released..
...Or it wasn't pressed at all :P

56
General / Re: Mouse isButtonReleased
« on: March 19, 2016, 12:02:16 am »
There is an event sf::Event::MouseButtonReleased :-)

57
Graphics / Re: Maximum image size on old machines
« on: March 18, 2016, 10:59:00 pm »
...4. Buy your friend a new graphics card if his/her b-day is soon!

58
SFML projects / Re: Squid Blaster
« on: March 18, 2016, 08:02:28 pm »
2 more things:

1. The game became quite a bit easier as soon as i realized i could also teleport from top to bottom of the screen. Was that intended?

2. According to the ReadMe file i have to hover over the big fish for a couple of seconds, but i don't see a cursor in the game window :-D

59
SOooo....When can we alpha test it? :D

60
SFML projects / Re: Squid Blaster
« on: March 18, 2016, 07:09:50 pm »
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.
I could be wrong, but the following might explain what i experienced. Take a look at the following image:

The purple area is part of the sprite. When I played your game, it felt like you're checking against the sprite's image boundaries. If so, then there's a pretty big border around the visual turtle, that actually counts as a hit eventhough it LOOKS like the turtle doesn't hit a squid.

As for graphics, I forgot to explain this, but I had intended for it to be a little more like retro pixel art. However, I always resort to pixel art style games because I make my graphics with Paint
I can totally appreciate the retro pixel art look. And Paint is perfectly fine to do pixel art with (although i'm sure there are better alternatives with regards to sprite animation). However, since the game is windowed you might want to consider doubling the pixels (pretend a block of 4 pixels is in fact 1 pixel). Following picture shows what i mean. It's more pixelized, yet still has detail - making it retroooooo:


If i didn't double the pixels, but kept to the original, smoother version it would look like this:



Note: I increased the size of the turtle to better fit the available space in the image (75x75 pixel sprites).

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
For the example turtles i actually used an old version of Flash and Paint. I can't think of a good tutorial but if you stick to pixelart i'm sure there are some good tutorials on this.

Pages: 1 2 3 [4] 5 6
anything