Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [SFML 2.1 and C++] 2D Shooter - Pew (Open Source)  (Read 46989 times)

0 Members and 1 Guest are viewing this topic.

nebula

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Email
[SFML 2.1 and C++] 2D Shooter - Pew (Open Source)
« on: November 03, 2013, 03:53:40 am »

Okay, let me introduce "Pew",
my first Game - a simple 2D Space Shooter.


I start with some pictures.

menugamesettingsgame overhighscore

A video of the Game
http://youtu.be/Gwmj3inet-g


Update
http://youtu.be/Lz6h8L5a3ls

(click to show/hide)

At the moment the game has no goal but to survive and I think that this will not change until I have the final boss.
Feel free to tell me what you think of it.


here you can get the release:
http://www.xup.in/dl,13847981/Pew.zip/

(if you can not play it, just inform me. I will try to help  ;))

the code is at github (i will try to keep that up to date, so changes will be seen first there):
https://github.com/nebula2/Pew


Control:
Q and E to change weapons (you get the second weapon at 1000 points, the third after the first boss)
WASD to move
Left Mouse Button to shoot


« Last Edit: September 14, 2015, 08:12:06 pm by nebula »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6259
  • Thor Developer
    • View Profile
    • Bromeon
Re: Pew
« Reply #1 on: November 03, 2013, 11:27:30 am »
Hey,
i am currently learning c++ and from some tutorials on youtube it came that i am using sfml.
Please don't. YouTube is the worst source when it comes to learning C++ and SFML. The video creaters often use very bad code style and omit important background information. See also my explanations here and here. Especially for C++, there is no way around a good book.
 
i will put in my code here. but i cannot give you the sound and images, neither screenshots or something, because i used some stuff i googled and i am not sure about the copyright.
Ok, but doesn't this somehow miss the point of a project presentation? If I were you, I'd create own assets or at least use free ones. You'll probably also want people to play your game one day. Code itself is not very interesting and will only confirm the hypothesis about bad YouTube tutorials :P
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: first SFML book

Raincode

  • Full Member
  • ***
  • Posts: 116
    • View Profile
Re: [SFML 2.1 and C++] 2D Shooter - Pew
« Reply #2 on: November 16, 2013, 09:08:34 pm »
Alright, here's the deal. The zipped package won't work. Simply the fact that it ships with the debug .dlls seems wrong.

So try to build in in release mode and put in the release dlls and upload it again

Kind Regards,
Raincode

nebula

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Email
Re: [SFML 2.1 and C++] 2D Shooter - Pew
« Reply #3 on: November 16, 2013, 10:28:59 pm »
oO okay.. a few of my friends tested it and it worked.. or do you mean the second link?

the debug dll files are meant to be there. I tried to rebuild sfml with cmake just like in the tutorial, but at the compilation i get errors..

so to get this work I googled and just got answers that couldnt help. So i put in all libraries into the release mode. and now it works at other pc's.
« Last Edit: November 16, 2013, 10:33:47 pm by nebula »

nebula

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Email
Re: [SFML 2.1 and C++] 2D Shooter - Pew
« Reply #4 on: November 17, 2013, 01:05:49 am »
added cooldown for the third weapon

but i have a problem with the CircleShape..

you will see this is you get to 2000 points :D

http://www22.zippyshare.com/v/52718290/file.html

Raincode

  • Full Member
  • ***
  • Posts: 116
    • View Profile
Re: [SFML 2.1 and C++] 2D Shooter - Pew
« Reply #5 on: November 17, 2013, 09:14:47 am »
Yes, and the same goes for the link you just posted. It complains about not finding "sfml-graphics-2.dll", there are only the "sfml-bla-d-2.dll" ones and if I try adding the right ones (which was pretty certain not to work), it complains about not finding ceratin Points in the dll files.

why not
sf::FloatRect controlR( control.getGlobalBoundz() ); ?

instead of
sf::Rect<float> controlR = sf::Rect<float>::Rect(control.getGlobalBoundz());

I also advise you not do do the "using namespace sf", and I wouldn't put it in header files...
« Last Edit: November 17, 2013, 09:20:39 am by Raincode »

nebula

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Email
Re: [SFML 2.1 and C++] 2D Shooter - Pew
« Reply #6 on: November 17, 2013, 02:34:40 pm »
Quote
Yes, and the same goes for the link you just posted. It complains about not finding "sfml-graphics-2.dll", there are only the "sfml-bla-d-2.dll" ones and if I try adding the right ones (which was pretty certain not to work), it complains about not finding ceratin Points in the dll files.

okay that is strange. but i do not know how to fix this. if I build the release (I use visual basic 2010 express) it creates a release directory with exactly the sfml-bla-d-2.dll files and it works. I will see what I can make.

Quote
why not
sf::FloatRect controlR( control.getGlobalBoundz() ); ?

instead of
sf::Rect<float> controlR = sf::Rect<float>::Rect(control.getGlobalBoundz());

I also advise you not do do the "using namespace sf", and I wouldn't put it in header files...

that is because I started the project when i started with c++ and sfml. I removed the namespaces. you can see it on github ;-) so how the hell do I solve the dll problem :'D
« Last Edit: November 17, 2013, 03:08:46 pm by nebula »

Raincode

  • Full Member
  • ***
  • Posts: 116
    • View Profile
Re: [SFML 2.1 and C++] 2D Shooter - Pew
« Reply #7 on: November 17, 2013, 03:24:44 pm »
I would guess simply emit the "-d" in the names of the .lib files in your Project settings when building the release version.

Maybe it's some problem with my system, I don't know...

nebula

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Email
Re: [SFML 2.1 and C++] 2D Shooter - Pew
« Reply #8 on: November 17, 2013, 03:30:35 pm »
I would guess simply emit the "-d" in the names of the .lib files in your Project settings when building the release version.

Maybe it's some problem with my system, I don't know...

I will try some ways maybe I get something to work for you :D

nebula

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Email
Re: [SFML 2.1 and C++] 2D Shooter - Pew
« Reply #9 on: November 17, 2013, 03:45:23 pm »
here is what i get:

properties:



(if I set static here i get only errors)


what I get


Note that I do not even put the d-2.dll files into the linker :D

Raincode

  • Full Member
  • ***
  • Posts: 116
    • View Profile
Re: [SFML 2.1 and C++] 2D Shooter - Pew
« Reply #10 on: November 17, 2013, 03:59:28 pm »
Hey,

I believe it's because you are using 2.1, I had 2.0

I'll just try it with the right dlls this time

Raincode

nebula

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Email
Re: [SFML 2.1 and C++] 2D Shooter - Pew
« Reply #11 on: November 17, 2013, 04:07:15 pm »
okay ;) would be nice if this problem is solved. I am just at the beginning of learning how to program so I am not that helpful at the moment :D

wintertime

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
Re: [SFML 2.1 and C++] 2D Shooter - Pew
« Reply #12 on: November 18, 2013, 12:14:16 am »
On the picture is at least sfml-graphics twice in different versions included and maybe more if scrolling down. This can yield errors.

Better consider this when sorting them in the list:
- graphics depends on window
- window, audio, network depends on system

nebula

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Email
Re: [SFML 2.1 and C++] 2D Shooter - Pew
« Reply #13 on: November 19, 2013, 05:44:17 pm »
sry for not answering i got a new pc and i first need to set it up. maybe i can set everything static now :D i will keep you guys updated ;)

nebula

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Email
Re: [SFML 2.1 and C++] 2D Shooter - Pew
« Reply #14 on: November 22, 2013, 08:38:43 pm »
So, I tried it again and again :D nothing changed.

I sorted the lib files to the dependencies but that did not affect anything (I think that this even ain't a problem in visual).

I further came to the conclusion that I only get errors if I set SFML_STATIC. Dynamic linking works smoothly. But tonight i am going to try recompiling SFML with cmake again. let's see how this works out.

 

anything