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.


Topics - woskaz0n

Pages: [1]
1
Graphics / Localize mouse position
« on: December 23, 2008, 10:42:17 pm »
Hi everybody,

I want to find out if my mouse is about an area or an object (with other words, a sprite  :) ).
(this sprites are not made by myself!!!)

An example: Here the mouse can be about the Tile 1, 2 or about the empty space... the thing that could make it a bit different is, that I don´t want to use fix coordinates in my source, like
Code: [Select]
(Cursor.GetPosition().x >= 200)

So, I tried a few things, but without any succes^^
Code: [Select]
if((Cursor.GetPosition().x == Sprite1.GetPosition().x) && (Cursor.GetPosition().y == Sprite1.GetPosition().y))
Why does it not work?

Thanks in advance!

2
Graphics / Problem with sf::IntRect
« on: November 30, 2008, 04:11:56 pm »
hi everybody again  :D

I´m sorry that I´ve to ask quite a lot, but sometimes I´m unable to find a possible solution.

This time I want to load some images from a sprite sheet, like this...


For this I use the sf::IntRect function... but I don´t know how to set the parameters. After I tried a few things, I allready know that the two last parameters give the size of the sprite.
So I guess the other two are standing for the position, but this won´t work
Code: [Select]

sf::IntRect Rect(0, 0, 45, 45);   /* Everything allright... the first sprite is shown.*/

sf::IntRect Rect2(45, 0, 45, 45); /*This should cut out the second sprite, but when I display it, it appears just a black screen */

sf::IntRect Rect(-45, 0, 45, 45); /*What happens now, you can see in the screenshot below...





So, what have i to do, that the second sprite is shown on the screen?

Thanks in advance!

3
Graphics / Not all tiles from TileMap are shown
« on: November 30, 2008, 01:16:47 am »
Hi everybody,

I tried to create a little tilemap. i thought it should be no problem, but unfortunately nothing works really well  :) .

At first, my code....
Code: [Select]

//of course i don´t post everything
int TileMap[mapHoehe][mapBreite] =
{
{1,1,1},
{1,2,1},
{1,1,1},
};

for(int y = 0; y < mapHoehe; y++)
{
for(int x = 0; x < mapBreite; x++)
{
if(TileMap[y][x] == 1)
Map1 = true;
if(TileMap[y][x] == 2)
Map2 = true;
}
}

/* In the main-loop */

if(Map1 == true)
           Window.Draw(Tile1);
       
if(Map2 == true)
           Window.Draw(Tile2);


But if I start the program, just one tile is shown, instead of 9.
Thanks for your help!

4
Graphics / Strange Collision
« on: November 23, 2008, 06:01:00 pm »
Hi everyone,

first at all - I really like the SFML, but sometimes I got problems that gives me a headache  :(

I want to test the collosion between two sprites. Actually no problem with functions like for example Player.GetPosition().x or Player.GetSize().x.

But unfortunately it works rather complicated...

this is my code
Code: [Select]
if(Window.GetInput().IsKeyDown(sf::Key::Right))
if(Player.GetPosition().x + Player.GetSize().x <= Wall.GetPosition().x)
{
//not the important part...
if(Player.GetPosition().x <= 1024-Player.GetSize().x) Player.Move( 400*Window.GetFrameTime(), 0);
}



The red one should be the player, and the wall is the fence
There everything works perfect... I´m not able to move the "player" to the right side.


But there I´m also not able to move the player to the right side? Why?
thanks in advance

5
Graphics / Animation of some Sprites
« on: November 17, 2008, 08:46:43 pm »
Hi all,

befor I used the SFML, I tried to code some games with the SDL (and a little Framework).
Now I want to write a little programm, where the Player can move his character on two axes with the keyboard (the basic function of an jump´n´run game). But now I got the problem, that I don´t know, how I have to animate the Player. I allready solved that problem when I used the SDL with a little Framework, but now I want to write my programm, just with the API!

Some pictures to illustrate my problem:


Well, in this picture the Plane should lean to the right side, when the right key is pressed and to the left, while the left key is pressed. When no key is in action, the middle frame should appear on the screen! I hope I could explain this clearly enough.


Or perhaps like in this example, where the asteroid should be moving all the time in a loope.

I hope you can help me, beacause I need this animations for a lot of things I want to do.
Thanks in advance!

PS.: And sry if my english is too terrible.

Pages: [1]
anything