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 - Tigre Pablito

Pages: 1 2 [3] 4 5 ... 15
31
General / Re: SFML cicrle movement
« on: December 24, 2018, 12:07:15 am »
Hi Guys

I have one doubt: shouldn't the rotation attribute be updated after that formula? Or it is automatically?


body.move( -sin(body.getRotation()*3.14159265 / 180)*-3, -cos(body.getRotation()*3.14159265 / 180) * 3);

If you don't do this

body.setRotation(body.getRotation() + rotation);

wouldn't it go like by a line (constant)?

32
Hi  8)

As eXpl0it3r said, you would have to set the mouse position (according to the joystick movement)  ;)

You don't need to translate the mouse event handling, but handling the joystick event to move the mouse cursor  :P

you would need to have an X and Y vars to store the current mouse position,

then when you move the joystick to your right, then increase X, when you move up, then decrease Y, etc, etc ... (I don't know the code for this, please query C++   ::))

and then, just set mouse position to (X, Y)

sf::Mouse::setPosition(X, Y);    // I'm not sure of this cos I don't know C++, query the correct syntax  ::)

Hope this helps  :)

33
General / Re: Adding shapes to vector
« on: November 07, 2018, 03:19:39 am »
Hi,

I'm sure that it works with an array, but I'm not sure if it works with a vector (List<T> in C#)

i.e. (in C#)

Parent[] array = new Parent[] { new Child1(), new Child2(), new Child1(), new Child4() };

Or maybe if you don't make the generic type "const" ... ?  ::)

........

What has happened with your Arkanoid clone project? Remember that Hapax and i tried to help you?  ;D
(sorry for the out of topic)

34
General / Re: How can i block sprite to outside screen ?
« on: October 28, 2018, 08:55:01 pm »
Just ask (with an if statement) if your sprite will step outside the screen before making it move, and if it will, then don't move it.
This is, if X is not lower than screen left, if Y is not lower than screen top, if X + WIDTH is not greater than screen left + screen width - 1, and if Y + HEIGHT is not greater that screen top + screen height - 1

If you can be more specific maybe you can get more and better replies

35
General / Re: Issue with collision
« on: September 21, 2018, 04:14:31 am »
Hi,

you gave this code,

else if (Collision::PixelPerfectTest(ball, paddle.getShape()))
{
   if (!ball.getGlobalBounds().contains(paddle.getShape().getPosition().x, paddle.getShape().getPosition().y))
        {
             y_ballSpeed = -y_ballSpeed;
        }
}

maybe if you add to the condition that the ball is going to the bottom of the screen, like this

   if (!ball.getGlobalBounds().contains(paddle.getShape().getPosition().x, paddle.getShape().getPosition().y)
&& y_ballSpeed > 0
)

to avoid the issue Hapax wrote about ... otherwise, when the ball hits the paddle on its very very edge, as the ball´s Y comes very low, the original condition would be true more than once, making the sentence:

y_ballSpeed = -y_ballSpeed;

execute a few times and getting a wrong behaviour of the ball

but if the condition requests the ball leading to the bottom, there won´t be a 2nd execution of that sentence because on the 2nd time the ball will be pointing to the screen top

Hope this helps

36
General / Re: Collision by differentiating colors
« on: September 01, 2018, 07:12:50 pm »
Hi

It's a run time error (no compiler error because the compiler can't guess that maybe the player will atempt to access out of the maze image bounds)  ;) . Usually they are the most difficult to detect because of that, there is no message.

I had thought about this possibility before, but then I believed that the maze image borderlines would be 'wall' color so that you would lose before step outside the image bounds

To prevent this you could check, before the player scrolls to another position, if it would step outside (for example, if the maze image is 800x600, no part of the player can be at (805, 347). No part, not only the (left, top),  because the collision function will be accessing the image's region that is occupied by all the player's area, and if in a call to GetPixel() X or Y are < 0 or > (800, 600) it will throw an "Out of range" Exception)

public bool CheckStepOutside(newPosX, newPosY)
{
    if (newPosX < 0 || newPosY < 0 || newPosX + 20 > 800 || newPosY + 20 > 600)
        return true;
    return false;
}
 

You can get the (x, y) where the player will be on next frame, and just allow it to scroll if the function (passing x and y to it) returns false.


37
General / Re: Collision by differentiating colors
« on: September 01, 2018, 12:56:18 am »
Hi Blingu
Hi Hapax

I have an idea about how to approach this, suppose the maze image is 800x600 and the player is 20x20, and suppose the players's Position is (posX, posY), then to know if the player has touched at least 1 pixel of the wall would be (Please someone translate to C++ - Thanks!)
(I think the function should be part of the player class, and recieve the maze image as an argument)

public bool CollideWithWall(Image image)
{
    int a, b;
    for (a = 0; a < 20; a++)
        for (b = 0; b< 20; b++)
            if (image.GetPixel(posX + a, posY + b) == wallColor) // define wallColor
                return true;
    return false;
}
 

The function above checks one by one all pixels from the maze Image that are occupied by the player, and returns true when it encounters the first (just one pixel is needed to collide). If it doesn't find anyone, then returns false.

We also suppose the player's Sprite's Origin has its default value (0, 0).

Finally, as I was taught in this Forums, there shouldn't be magic numbers in the code, so we can replace 800 and 600 by MAZE_WIDTH and MAZE_HEIGHT, and 20 and 20 by PLAYER_WIDTH and PLAYER_HEIGHT

Hope this helps
Pablo

38
Graphics / How to draw in an Image?
« on: July 26, 2018, 10:26:01 pm »
Hello

Would someone have a good way or function for drawing a RectangleShape in an Image?

And an Image in another Image?

Thank you

(C# if possible please)

39
General / Re: My poor SFML games don't run on a specific PC
« on: July 26, 2018, 01:35:16 am »
Hi Laurent

I updated the device controllers or drivers through Windows control panel and now my game runs fine, so thanks

About the other issue, I was just trying to be funny ... it was not my intention to annoy anyone

Maybe my humor sense is not the best (and maybe my games are OK)

Though I think there are worse things than that, I'll try to be more serious in my posts

40
General / Re: My poor SFML games don't run on a specific PC
« on: July 16, 2018, 10:22:00 pm »
Hi dabbertorres

It is

NVIDIA GeForce 7025 / NVIDIA nForce 630a (Microsoft Corporation WDDM)

41
General / My poor SFML games don't run on a specific PC
« on: July 16, 2018, 07:03:33 pm »
Hello, Ladies and Guys

The system is

Windows 7 Ultimate 64 bit Service Pack 1

AMD Athlon II X2 245 processor 2.90 Ghz  2.0 GB RAM

I'm using SFML.Net 2.2

When trying to run from the VC# IDE it crashes on every Draw() call ...

Thanks for any help

42
General / Re: player-wall collision in game
« on: July 01, 2018, 05:14:34 am »
Hi

I agree with you that Hapax's first option is the best (for this case at least)

What I would suggest is to add into the main loop (maybe in the players update() function), (instead of the code you showed), something like this:

while (collideLeft())
    pos.x++;
while (collideRight())
    pos.x--;
while (collideUp())
    pos.y++;
while (collideDown())
    pos.y--;

You would have to define the 4 functions

If you (that it seems) make the player move by 'walkSpeed' pixels, then it may happen that you get stuck into the wall by more than 1 pixel, that's why the code above loops: *) nothing, if you haven't hit a wall, *) or, until you are at 0 pixels from it if you have (for the 4 possible ways ... you can put each one with the code that moves the player on its own direction, for higher performance)



43
Feature requests / Re: Better gamepad support
« on: June 10, 2018, 05:30:22 am »
Although, yes, I must agree that this feature request, better gamepad support has to do with a multimedia library

44
Feature requests / Re: Better gamepad support
« on: June 10, 2018, 05:24:23 am »
I'd like to add gamepad support for my game, is there some place I can found something already written ?

I can help but please, don't debate endlessly if it should be included or not in SFML, most likely it should. If SDL did something, it's probably for a good reason, it's worth for SFML to take inspiration from it.

Hi Phanoo

I don't know why, it seems that you like SDL more than SFML. As far as I know, nobody is forcing you to stay in SFML if you like SDL more. It is completely up to you to decide where you are

I have played the game Ach Ball (and it's good), but soon it will be launched the game Break Balls, that took inspiration in your posts with hard arguing on feature requests that have nothing to do with a multimedia library and comparisons between SFML and SDL and prompting people to switch to SDL

Unless that you are staying in SFML for charity, if SDL suits you best, you are free to switch wherever you want, so as others are, plus they don´t need to be given directives about where to switch to or stay in

This is SFML and "there is what there is" (HAY LO QUE HAY, in Spanish). Actually I started in SDL and switched to SFML, but everyone is free to go/switch/stay wherever he/she wants to. But when I switched to SFML I did not make a mess and a movement in the SDL mailing list.

Regards

45
DotNet / Re: SFML.Net setting window active AND music loop points
« on: May 29, 2018, 02:03:49 am »
Yes, it's very improbable that the window loses focus, you're right, maybe only by an appearing window that asks you to buy further antivirus protection. For those very few cases what I'll do is handling the LostFocus event with a game pause function. Thanks for your replies.

Pages: 1 2 [3] 4 5 ... 15
anything