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

Pages: [1]
1
General / Re: Disabling the delay on holding down a key (HELP)
« on: September 12, 2012, 03:58:43 am »
Thanks, worked!

2
General / Disabling the delay on holding down a key (HELP)
« on: September 11, 2012, 11:54:59 pm »
I'm using SFML 2.0-rc, Windows 7, Visual Studio 2010.

Here's my snippet of code:

if (sf::Keyboard::isKeyPressed(sf::Keyboard::W))
{      
new_ypos = old_ypos - movespeed;
}

This sits inside the
while (window.pollEvent(event))
.

So, basically when I hold W, my character moves forward for a second, pauses for about 1 second, then W holds down. I know this is the delay in the operating system. The same thing happens when you hold a key on a text document.

Is there any way to get rid of this so that I don't have to wait for that 1 second delay before the character moves continuously, without changing the OS settings? I know where the OS option is, but I don't want to do this if I want to send the game to other people.

So does SFML have anything, or C++?

3
Graphics / Re: Adding collision rectangles to tiles (Help)
« on: September 09, 2012, 10:29:43 pm »
Worked, Thanks!

4
Graphics / Re: Adding collision rectangles to tiles (Help)
« on: September 09, 2012, 09:49:53 pm »
I see what you guys are saying, but I just can't get it to work -_-


This is one part of what you asked for:

float CollisionRectangles[24][33];

and  this line was giving me that error:

CollisionRectangles[nrow][ncol] = sf::FloatRect (ncol*32.f, nrow*32.f, 32.f, 32.f);

I'll try to explain again,

Basically I'm trying to put a rectangle the same size and position over every tile on the tile map, which lets me use the check intersect function with the player sprite's rectangle to establish collision detection.

I don't know how to put a different rectangle onto every tile of the tilemap. (I am going to use a for loop to cycle through them later and check each tile for collision).

5
Graphics / Adding collision rectangles to tiles (Help)
« on: September 09, 2012, 08:27:12 pm »
I'm using sfml 2.0-rc, Windows 7, and Visual studio 2010.

Here is my snippet of code:

for(int nrow = 0; nrow < 24; nrow++)
                {
                        for (int ncol = 0; ncol < 33; ncol++)
                        {
                        sprite2.setPosition(ncol * 32, nrow * 32);
                        sprite1.setPosition(ncol * 32, nrow * 32);
                        if (dDungeon[nrow][ncol] == '#')
                                {

                                CollisionRectangles[nrow][ncol] = sf::FloatRect (ncol*32, nrow*32,32,32);
                                window.draw(sprite1);
                                }
                        if (dDungeon[nrow][ncol] == ' ')
                                {
                                window.draw(sprite2);
                                }      
                        }
                }

I'm getting some kind of error when I hover over the sf::FloatRect, which reads:

"Error: No suitable Conversion function from "sf::FloatRect" to "float" exists.

I don't really understand this at all, can anyone help?

With this code, I'm creating a tilemap from sprites, and putting one collision rectangle over every single sprite so that I can define collision detection later with a moving character sprite.

So how do I load 792 different (24*33) collision rectangles into an array made to store them?

6
General / Re: Help with Tile Based Animations
« on: September 08, 2012, 06:03:05 pm »
Okay, thanks. The reason I was drawing my character on the same array as the map (which limits his movements to the grid) was because that's how i set up the collision detection. (It checked if the new tile was something he couldn't go on, then put him back.

Do you have any advice on how to set up the collision detection if the character freely roams on the screen per pixel?

7
General / Help with Tile Based Animations
« on: September 08, 2012, 08:15:15 am »
I'm using SFML 2.0-rc, windows 7, and visual studio 2010.

My character is on a tile map. When I hit 'W', he goes up, but obviously he goes from the bottom tile to the top instantly with no animation.

Does anyone have any suggestions for animating his climb from the bottom tile to the top that doesn't interrupt the game being real time?

My tile map uses a char array, so I can't figure it out because I can't set values inbetween numbers (ie. 1, 1.2, 1.3, ect..) I can only do 1, 2, 3 which is jumpy.

8
Window / Re: Help, Printing an Array to Window is causing unusual Display
« on: September 07, 2012, 09:35:12 pm »
Thanks! I've fixed it based on your reply. It works now. You're the best.


9
Window / Help, Printing an Array to Window is causing unusual Display
« on: September 07, 2012, 09:14:34 pm »
I need help desperately, I am on Windows 7, using SFML 2.0-RC, and visual studio 2010.

Here is the snippet of code:

 

And here what is being outputted (attachment).


Why is there a space of nothing, and then suddenly the first row?

Why is the first row being printed after everything and the null pointer? Why is it starting at the index point "1" in the array instead of "0" like it should? (As in it starts at 1, gets to the null pointer, then goes back to 0.)

Thanks for your help.


Pages: [1]