1
General / Re: What Is Wrong With This Line Algorithm?
« on: May 18, 2019, 02:15:08 am »
Oh wow, it worked. I don't know how that passed my potato brain, but thank you for responding!
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.
sfml-graphics-s
(All dependencies for graphics)
sfml-window-s
(All dependencies for window)
sfml-system-s
(All dependencies for system)
sfml-audio-s
(All dependencies for audio)
s Folder\CodeBlocks\SFML-2.4.2\lib\libsfml-audio-s.a(InputSoundFile.cpp.obj):InputSoundFile.cpp|| undefined reference to `sf::FileInputStream::FileInputStream()'|
s Folder\CodeBlocks\SFML-2.4.2\lib\libsfml-audio-s.a(InputSoundFile.cpp.obj):InputSoundFile.cpp|| undefined reference to `sf::FileInputStream::open(std::string const&)'|
s Folder\CodeBlocks\SFML-2.4.2\lib\libsfml-audio-s.a(InputSoundFile.cpp.obj):InputSoundFile.cpp|| undefined reference to `sf::MemoryInputStream::MemoryInputStream()'|
s Folder\CodeBlocks\SFML-2.4.2\lib\libsfml-audio-s.a(InputSoundFile.cpp.obj):InputSoundFile.cpp|| undefined reference to `sf::MemoryInputStream::open(void const*, unsigned int)'|
s Folder\CodeBlocks\SFML-2.4.2\lib\libsfml-audio-s.a(SoundFileFactory.cpp.obj):SoundFileFactory.cpp|| undefined reference to `sf::MemoryInputStream::MemoryInputStream()'|
s Folder\CodeBlocks\SFML-2.4.2\lib\libsfml-audio-s.a(SoundFileFactory.cpp.obj):SoundFileFactory.cpp|| undefined reference to `sf::MemoryInputStream::open(void const*, unsigned int)'|
s Folder\CodeBlocks\SFML-2.4.2\lib\libsfml-audio-s.a(SoundFileFactory.cpp.obj):SoundFileFactory.cpp|| undefined reference to `sf::MemoryInputStream::seek(long long)'|
s Folder\CodeBlocks\SFML-2.4.2\lib\libsfml-audio-s.a(SoundFileFactory.cpp.obj):SoundFileFactory.cpp|| undefined reference to `sf::FileInputStream::FileInputStream()'|
s Folder\CodeBlocks\SFML-2.4.2\lib\libsfml-audio-s.a(SoundFileFactory.cpp.obj):SoundFileFactory.cpp|| undefined reference to `sf::FileInputStream::open(std::string const&)'|
s Folder\CodeBlocks\SFML-2.4.2\lib\libsfml-audio-s.a(SoundFileFactory.cpp.obj):SoundFileFactory.cpp|| undefined reference to `sf::FileInputStream::seek(long long)'|
s Folder\CodeBlocks\SFML-2.4.2\lib\libsfml-audio-s.a(SoundFileFactory.cpp.obj):SoundFileFactory.cpp|| undefined reference to `sf::FileInputStream::~FileInputStream()'|
You said you had no luck trying to use trig, but could you be more specific? What did you try and what wasn't working?
Basically you just need to calculate a relative vector from the origin of your character sprite to the end of the gun, similar to what you have already done in the code you showed us. Then, rotate that vector based on the character's sprite rotation. You can use SFML's Transform class for this if you want to make things easier.