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

Pages: 1 ... 197 198 [199] 200 201 ... 224
2971
General discussions / Re: SFML tutorial video
« on: August 30, 2014, 03:57:58 am »
__YOU_ARE_WELCOME__

2972
Graphics / Re: Tile Editor is off center?
« on: August 30, 2014, 03:55:26 am »
 :o

GridSizeX instead of Grid.size()
GridSizeY instead of Grid[0].size()
They're the same values.

You should be testing to see if they (indexX and indexY) are less than the size, not greater than.
Also, test to make sure they're zero or higher. It can crash when they're below zero. (obviously e.g. Grid[-1]  :o)

This is just a vector of sprites with different textures, you know. The actual map isn't stored anywhere. How will you be saving this?  ;)

2973
Graphics / Re: Tile Editor is off center?
« on: August 30, 2014, 03:43:25 am »
        if(indexY <= Grid.size())
As I mentioned earlier, these should never be equal.
Also, the size of "Grid" is the x size. For y, you need Grid[0].size(). Better still, just use GridSizeX and GridSizeY  :P

I see that you copied my code. You should've typed it; you may have noticed the error ;) I fixed it now though; see if you can see what I changed  ;D

I fixed most of the problems
Lies! I fixed them  8)

2974
Graphics / Re: Tile Editor is off center?
« on: August 30, 2014, 03:13:15 am »
Much better now that I can see it with the right images  ;D

I'm going through your code (for fun 8)) and I'm noticing a few things here and there that should be fixed before it causes your problems later on.

Your grid iteration is mixed.
Quote
   Grid.resize(GridSizeY);
   for (int x = 0; x < GridSizeX; x++)//Column
   {
      for (int y = 0; y < GridSizeY; y++)//Row
      {
         Grid[y].push_back(blankGridSprite);
         blankGridSprite.setPosition(x * 32, y * 32);
      }
   }
That makes no sense as you are resizing the grid to hold rows and then go through them as columns. Then, when you're iterating the "y", you're pushing the new y's based on the y. That was not a very good explanation of what I mean. However, in your code-style, I think it should be this:
        Grid.resize(GridSizeX);
        for (int x = 0; x < GridSizeX; x++)//Column
        {
                for (int y = 0; y < GridSizeY; y++)//Row
                {
                        blankGridSprite.setPosition(x * 32, y * 32);
                        Grid[x].push_back(blankGridSprite);
                }
        }

You should replace all of your usage (you used it 6 times) of rint (as I found that it's rounding to the nearest integer, which is upwards when it hits halfway) with floor. Try it. Trust me  8)

Cases in a switch statement don't need block braces. Just so you know  ;)

You should probably handle the failures when loading textures. Returning from the application seems to make sense since you can't use it without them.

Your outputting of row and column are incorrect. Row should be y and column should be x.

You mix up X and Y access again in the Grid vector here:
Quote
Grid[indexY][indexX].setTexture(tileTexture);
and here:
Quote
Grid[indexY][indexX].setTexture(blankGridTexture);

You are only testing to make sure that Y is within boundary (the bottom of the grid). You aren't testing for the top, or testing the x for the sides. Also, if y equals Grid.size(), it's accessing an element that is not there.

You are loading in your images and creating your textures and sprites on every cycle. Take them outside the main window loop and load them just once.

As for the problem you mentioned about it drawing on the bottom and missing the last tile off, it's because you're setting the position of the temporary variable after assigning it to the grid, so each tile is getting the position of the previous one (the first two have the same position).

You'll need to swap them to this:
                        blankGridSprite.setPosition(x * 32, y * 32);
                        Grid[x].push_back(blankGridSprite);
and then remove the +1 from indexY.

After making these modifications myself, it works perfectly and never crashes  8)

2975
Window / Re: [SFML 2.0]Problem with repeating buttons and events.
« on: August 30, 2014, 01:50:00 am »
@Ixrec, my wording did sound misleading; you're right! "Dealt with" really meant that the events should be processed as they will be no longer available afterwards. Processed, to be more clear, does not mean advance your logic etc. based upon them, more taken note of and prepared for later usage. hehe

2976
Window / Re: [SFML 2.0]Problem with repeating buttons and events.
« on: August 30, 2014, 01:38:22 am »
The while loop processes (and then discards) all of the events that your window has received since the previous cycle. You should process all of the events while (pun not intended) you are in that loop. Basically, every event should be dealt with immediately (as soon as possible :P).
You can test all of the different types within that loop. You can use a series of ifs - probably nested to group the types - but they should probably be else ifs. You can also use switch here but ifs can be safer as breaks are often forgotten from switches  ;D

2977
Graphics / Re: Tile Editor is off center?
« on: August 30, 2014, 01:33:03 am »
This moves a tilemap with the mouse.

Could you supply the images so I can see what it's supposed to look like rather than using some of my own random images  ;D

2978
General discussions / Re: SFML tutorial video
« on: August 30, 2014, 01:19:54 am »
I got as far as noticing that you used:
#include "SFML/Graphics.hpp"
and then my mind exploded.

2979
SFML projects / Re: Thor 2.0
« on: August 29, 2014, 08:49:23 pm »
need to download your header only project
I believe Aurora is supplied with Thor. Just looked; it's in the extlibs folder.

2980
SFML projects / Re: Witch Blast (dungeon crawl shooter)
« on: August 29, 2014, 08:47:45 pm »
Ah, okay then  :)
I didn't realise that you could fire two different ways with one weapon. I did look to see if the other weapon did it too but it doesn't seem to so I thought I'd just check  ;D

2981
Try outputting getActiveLevelPlatformableIndex(i).getSpriteX() to see if the values are as expected.

2982
Window / Re: [SFML 2.0]Problem with repeating buttons and events.
« on: August 29, 2014, 08:17:23 pm »
I'm using bool paused like that:
if (!paused)
{
  okno.display();
}
Is paused a boolean or not? If so, why are you assigning it 1 and 0 instead of true and false, and why are you testing for comparison to 1 and 0 instead of paused and !paused? Mixing is confusing :p

I've checked it by using:
if (event.type == sf::Event::KeyPressed)
{
  cout << event.key.code << endl;
}
It returns key codes, but for letters/digits it does not return anything.
Can you create a complete and minimal example which uses this code and still has the problem you're describing so that we can compile and test it for ourselves? Does this bit of code work in other projects?

What is your B2?

2983
General / Re: FPS Peaks with VSync-enabled (59Hz refresh rate)
« on: August 29, 2014, 08:00:56 pm »
http://gafferongames.com/game-physics/fix-your-timestep/
This is almost always the link that I would recommend for timestep information.

2984
SFML projects / Re: Witch Blast (dungeon crawl shooter)
« on: August 29, 2014, 07:58:09 pm »
Did you notice that the blue particles sometimes have a darker outline?

2985
General / Re: Collision... yer driving me crazy
« on: August 29, 2014, 07:54:35 pm »
Hi, I'm trying to create a solid bounding box style collision system for my game. So far, I can tell whether or not the horizontal planes intersect, but whenever I attempt at detecting whether or not they intersect vertically, the horizontal detection overrides it no matter what order I program it in.
Could we see the vertical detection code and where you put it?

Pages: 1 ... 197 198 [199] 200 201 ... 224