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

Author Topic: Asteroids! Asteroids clone game SFML 2.0  (Read 4938 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 35
    • View Profile
Asteroids! Asteroids clone game SFML 2.0
« on: August 18, 2012, 09:18:16 am »
Hi, so I will now present my "latest" project. I have been working on this asteroids clone game very long. Mainly because I've not been motivated sometimes. First I made it in SFML 1.6, but then I re-coded it in SFML 2.0. Still the game isn't finished, I just wanted to show it off. I thought, that I could get some sort of motivation to finish the game, if I release it now.

Game is open-source, you can use code how ever you want.

Oh, right. How can you put universal load path in to your game? The only thing I need to load is font, but how can you make it to work for anyone?


W - Move towards
AD - Rotate ship
S - Go backwards
Space - Shoot

V - to re-generate that white dot(It's going to be some sort of bonus thing)

Esc - To close game

Download here:
http://www.mediafire.com/?5usqq6zqfuxz9o3 - Please note that the game is Mac Os X version, but it has full source and font. Not sure if the app even works for you...



  • SFML Team
  • Hero Member
  • *****
  • Posts: 10783
    • View Profile
    • development blog
    • Email
Re: Asteroids! Asteroids clone game SFML 2.0
« Reply #1 on: August 18, 2012, 11:02:06 am »
So I just downloaded and compiled it for Windows x64 and the only change I had to make is define M_PI on my own. It's better to do so anyways since M_PI from math.h or cmath isn't really that good.

Is this only on my PC or is it intetional, that the A key rotates the square clockwise and the D key counterclock wise, i.e. they are reversed... ???

In the console output I get a "The requested video mode is not available, switching to a valid mode" which then simply limits the view to a certain area of the whole screen. My resolution is 1600x900. ;)

Here's the download of a Windows x64 version (statically linked).

About the font/resource path. Pathes are mostly relative to the executable, thus if you place the font next to the executable and all loadFromFile("Vdj.ttf") then it gets loaded, although I'm not sure how to handle things crossplatform wise, i.e. if in OS X and Linux you can place the resources also next to the executable...
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
Dev Blog: https://duerrenberger.dev/blog/


  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Asteroids! Asteroids clone game SFML 2.0
« Reply #2 on: August 18, 2012, 11:14:00 am »
Thanks for your quick reply! About window resolution, I have set it optimal to my computer(Mac Book Pro). I didn't really think about resolution in other computers :o. But I actually "maybe" know how to set optimal window resolution when program starts. I really need to make some changes before I release next version...

I tried that load path first, but for someone reason it didn't work and I needed to make full load path(User/desktop etc.). I need to read more SFML documentation and find out how put it universal.