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

Author Topic: View for vertical shooter or not ?  (Read 2294 times)

0 Members and 2 Guests are viewing this topic.

Tadayoshi

  • Newbie
  • *
  • Posts: 4
    • View Profile
View for vertical shooter or not ?
« on: February 08, 2012, 11:38:25 pm »
Hi there I'm currently making a vertical shooter in SFML. This is my first Project in SFML so I'm new.

I have a question about the view:
Would it be better to use a view for an vertical shooter OR
Would it be better to just scroll the background and let the enemies appear on given time values...

I'm started with a view and ran in to a few problems, that's the reason I'm asking.

Because if i use a view I have to adjust nearly everything on the screen to the view, so I have to add a given value to the y position to every sprite in every tick to hold the whole sprite list in the center of the Window. Sounds not very good for the resources and the speed of the program.

So I assume the view is just a good choice for games like 2D RPG's. But I don't know if I'm right so I hope you can help me out with that. Or are there features in the view for that? I found the ConvertCoords function but it didn't served my needs..

Thank you. :?:

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
View for vertical shooter or not ?
« Reply #1 on: February 09, 2012, 12:48:19 am »
What sprites do you need to be static?

You know you can make a second view, leave it still, then draw your UI onto that?

The view works pretty well for any game where the screen can move.

Tadayoshi

  • Newbie
  • *
  • Posts: 4
    • View Profile
View for vertical shooter or not ?
« Reply #2 on: February 09, 2012, 12:58:07 am »
None of the sprites need to be static, but they have to be movable in the Window itself not in the View..  If I would use a View I would had to calculate where the view is in the scene and translate the "5 pixel up" to the current position of the view in order to move up 5 pixel on the Window, because the view would move every tick a certain amount of pixels down...

You know what I mean ? Like in the Spaceinvaders games...

So I thought just scroll the background and don't use the view...
I currently don't talk about the UI.

But I could think of a use of the views to spereate the sprites and the UI because the UI takes a 100px width on the right side on the window. But for the game mechanics itself I don't see any use of the view in this kind of game.. Or am I wrong ?

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
View for vertical shooter or not ?
« Reply #3 on: February 09, 2012, 01:38:16 am »
Ah I see.

Your idea seems right, so long as none of your entities need to interact with the terrain(such as following roads or destructible buildings).

You might want to use a view for the background, it might be more efficient than actually moving the background sprite(depending on what optimizations SFML has).

You should be fine to just keep all gameplay within a single screen and spawn enemies on time values.

Tadayoshi

  • Newbie
  • *
  • Posts: 4
    • View Profile
View for vertical shooter or not ?
« Reply #4 on: February 09, 2012, 01:40:00 am »
Thank you very much for your time.. :)