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

Pages: [1]
1
General / Re: Trying to sync rocket with rocket launcher
« on: February 04, 2022, 12:21:32 am »
That looks like getRot() is returning angles in degrees.
But cos and sin take angles in radians.
Try making it:
this->rocket->updatePos(sf::Vector2f(this->player->getPos().x + (25 * cos(this->rocket->getRot() * 3.141592654f / 180.f)), this->player->getPos().y + (25 * -sin(this->rocket->getRot() * 3.141592654f / 180.f))));

It also looks like the rocket is rotating in the wrong direction, if so, try removing the - from the sin part, that will reverse rotation.

Thank you very much, this works perfectly!

2
General / Trying to sync rocket with rocket launcher
« on: February 03, 2022, 10:20:56 pm »
Hello, I am trying to get the rocket to sync up with the rocket launcher. What my code does, is it sets the rocket to the position of the player, sets it's angle to the rocket launcher's angle, and then tries to move it a bit forward based on it's angle so that the rocket looks like it just got launched out of the launcher. The only thing that doesn't work is that the rocket is moving multiple times faster than the actual rocket launcher for some reason. The only thing that messed this up was when I tried to move the rocket forward from the player using sin and cos. Please help me sync them up so that the rocket looks like it's being fired from the rocket launcher.


    this->rocket->updatePos(this->player->getPos());
    this->rocket->updateRot(this->launcher->getRot());
    this->rocket->updatePos(sf::Vector2f(this->player->getPos().x + (25 * cos(this->rocket->getRot())), this->player->getPos().y + (25 * -sin(this->rocket->getRot()))));

 

Video of what is going on:

3
General / Need help with crosscompiling from linux to windows via mingw
« on: January 15, 2022, 10:26:40 pm »
I get this issue when trying to compile my project via mingw.

https://pastebin.com/raw/YPzk50BZ

The dlls are GCC 7.3.0 MinGW (DW2) - 32-bit, and I do currently have them in my build directory. I am currently on arch linux and I have installed sfml from: https://aur.archlinux.org/packages/mingw-w64-sfml/

4
General / Help with pixel perfect collision on convex shapes.
« on: June 28, 2021, 05:22:52 pm »
When I use the intersects() function, it only uses the hitboxes as a rectangle i think and it isn't accurate enough. I have already heard of flood fill and all of that, but I am struggling with implementing it. I would appreciate if someone could just put the code down there to help me get perfect pixel collisions on convex polygons.

Pages: [1]