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

Pages: 1 2 [3] 4 5
31
Graphics / HITBOX FloatRect
« on: June 10, 2022, 09:27:14 am »
Hello, i need a Hitbox for my player that is smaller than the Player Sprite Rect. I read that the FloatRect can do it, but theres is no getglbslBounds for it, can someonr give me an advise, how i can use a floatrect with globalbounds for my player sprite?

32
Graphics / Bullets turn direction failure
« on: May 30, 2022, 10:44:57 am »
Hello, i have a bullet direction Problem. I want that my Player can shot bullets to the right and left direction. I used this piece of code for that (I used setScale for flip the Players Direction):
bulletVec[i].bltFire(0, 2 * plr.plrSprite.getScale().x);
 
The Problem noq is that the firing Bullets always turning the direction when i turn the players direction, how i can change this?

33
Graphics / Re: Bullet Face direction problem
« on: May 28, 2022, 12:45:31 pm »
Is there any tutorial for a 2d shot game like probotector, i just find spaceship shot directon or topdown examples with angles, i dont need that  :-[

34
Graphics / Re: Bullet Face direction problem
« on: May 27, 2022, 09:16:07 am »
I search something that turn the following values into negative values when the player turns left

The player.playerSprite.getPosition().y + 100)) < -- the 100 have urn into - 100

newBullet.bulletSetPos(Vector2f(player.playerSprite.getPosition().x  + 60, player.playerSprite.getPosition().y + 100));  


 

An the move value 3 have to turn into -3
bulletRec.move(0, 3);

 

For the players face direction i used setScale(3, -3 ) and setScale (3, 3)

35
Graphics / Re: Bullet Face direction problem
« on: May 27, 2022, 09:02:32 am »
The bullet travel in the wrong direction.

36
Graphics / Bullet Face direction problem
« on: May 27, 2022, 08:04:33 am »
Hello, i need a solution for a 2d shot game. The player still shot to the right direction, i have no idea how i change the bullet direction when he walk to the left side?


//Touch Shot Button
if(btn.btnRect3.contains(worldPos)){
                                                                       
                           isFiring = true;      
}


//bullet shot details

if(isFiring == true){
       
        bullet newBullet (Vector2f( 20, 20));
        newBullet.bulletSetPos(Vector2f(player.playerSprite.getPosition().x  + 60, player.playerSprite.getPosition().y + 100));
        bulletVec.push_back(newBullet);
        isFiring = false;
   }



 

Any Ideas

37
Graphics / Re: Player View dont stop with the Player
« on: May 23, 2022, 12:54:52 pm »
Ok i got a solution

38
Graphics / Player View dont stop with the Player
« on: May 23, 2022, 11:50:10 am »
Hi
I have another question about sf::View. It is center to my Player and follow him. But if the Player collide with a wall and stop the view still moves if the move button is pressed. So here is my code when the Player  collide:
...

void player::plrBounce(Vector2f &wallBounce){
       
wallBounce = plrSprite.getPosition();
        plrSprite.setPosition(wallBounce.x, wallBounce.y +5);
       
}

...

if(plr.plrSprite.getGlobalBounds().intersects(WallRect.getGlobalBounds())){
       
                plr.plrBounce(wallBounce);

 

and here is my view setting:

View plrview( FloatRect(0, 0, 1300, 2600));
    plrview.setCenter(plr.plrSprite.getPosition());

 

So what could i do that the playerview is parenting to the player and stops when he stops??

39
Graphics / Re: Sf::View and How can i fix things on display?
« on: May 22, 2022, 09:23:21 pm »
Thanks do your answer. Is there any parenting function between player and playercam(view)? When my player stop at a wall the  playercam dont!

40
Graphics / Sf::View and How can i fix things on display?
« on: May 22, 2022, 08:06:09 am »
Hi,
I try to make 2d sidescroller with Touch on mobilephone. I used sf::View to follow my Player, and it works. But i have also 3 Buttons on display they move away. How can i fix them on display?

41
Graphics / Re: Not walk trough th Rect?
« on: May 20, 2022, 03:36:29 pm »
I got it
Solution:



void player::plrBounce(){

Vector2f wallBounce = plrSprite.getPosition();
plrSprite.setPosition(wallBounce.x, wallBounce.y -5);

42
Graphics / Not walk trough th Rect?
« on: May 20, 2022, 01:49:34 pm »
Hello again,
Sry i dont want annoying to fill this Forum with newbie questions, but this Forum give me the best answers.

So i am working on a sidescroller, in the middle of the Screen is a RectangleShape, and if i collide it with my playerSprite, the Background Moves. Now i want that the Player not go through the Rectangle, ho can i fix it, here is my codepart:


if(playerSprite.getGlobalBounds().intersects(rect.getGlobalBounds())){
               
        backgroundSprite.move( 0, -3);
        // playerSprite dont walk trough rect???
               
}

 

43
Graphics / Re: Flip Sprite setScale problem
« on: May 20, 2022, 01:40:18 pm »
Thank you

44
Graphics / Re: Sprite in multiple cpp files
« on: May 20, 2022, 06:57:15 am »
Thanks for your Answer, i fixed it, i let the sprite move in the main.cpp and only take the values from the other files

45
Graphics / Flip Sprite setScale problem
« on: May 20, 2022, 06:52:54 am »
Hello,
Maybe someone knows a solution. I have setScale(3 ,3.5) my Sprite coz its too small. But when i used setScale again to flip my sprite with (-1 ,1) when it move to left, the Sprite get small. Is there any way to safe the first setScale values for the Sprite? I dont wanna use other ways like for example IntRect(0,0,-weight, height) coz i used a Spritesheet and its getting to complicated with the animation.

Pages: 1 2 [3] 4 5
anything