Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Showcase / Starfighter Gosu Tutorial
- - By masonhale Date 2011-01-24 15:04
Hello Gosu community!

I've been working with my teenage son on a game, as a learning project. As part of that process we reconfigured the Ruby Tutorial game into 2D Galaga-style shooter. We have posted the project on GitHub here: https://github.com/masonhale/Starfighter-Gosu-Tutorial and will be presenting it at the Austin on Rails meeting tomorrow night: http://austinonrails.org/past/2011/1/9/meeting_tuesday_january_25_2010_700900_pm/

Please have a look. We are looking for feedback to make for a better presentation.

We are still working on slides for the presentation. We will post those as well when they are completed.

Thanks for the awesome library!
Parent - - By jlnr (dev) Date 2011-01-24 22:16
Hey, looking forward to seeing the slides! The whole final project of 300+ lines is pretty heavy to show around, maybe you should split it up into several files?

One thing is that's a bit quirky about Gosu is the 'tileable' argument in Image.new/load_tiles. It just affects the sharpness of the image borders when you stretch or rotate an image. So, if you fill the screen with zoomed-up map tiles, you should pass tileable=true. Conversely, the stars and player should be loaded with tileable=false, because if you zoom them up, even the border pixels should be uniformly 'blurred' (filtered).

Other than that, looks like a solid code base. If it bothers people, you can tell them that I am (still) working on getting all the 'window' arguments removed. They really ruin the beauty of your code in some places atm.

Have a good presentation :)
Parent - By masonhale Date 2011-01-25 00:45
Thanks for taking the time to review the code.

I've made the changes to the Image.new tileable parameters as you mentioned, and I also created a "final" version with a Main.rb file that loads additional classes from a new /lib/ directory. Should make things more manageable now.

Thanks again!

Will post the slides later tonight or early tomorrow.
Parent - - By RavensKrag Date 2011-01-30 20:11
If the 'window' arguments are removed, will Gosu function in a manner similar to Chingu, with a global $window?
Parent - By jlnr (dev) Date 2011-01-31 09:34 Edited 2011-01-31 09:41
Well, yes and no. Internally, the graphics and audio contexts are global and independent from the window, so you can do stuff like that (complete program):

i = Image.new("Player.png")
puts i.width


Playing audio without a window is not as cute, sadly. You might have to call Song#update every now and then, something that Window does for you right now. The idea is not to have a global window, but to decouple things in general. Window#draw_quad will also be Gosu::draw_quad etc.

I don't think it matters a lot in game design, because at some point you have something like a "game" that owns the map and objects, be it the window, a Chingu state, or an abstract object. All game objects will want to access that, so you're back to having a global or passing stuff around.

But with Gosu 0.8, helper libraries are able to do "image = Image.new('my_helpful_overlay.png')" without support from the enclosing program (passing the window). Also, having just a simple constant "GOBLIN_IMAGE = Image.new('goblin.png')" is something that is not possible right now.

I didn't change the reference and examples right now, but Song and Sample don't need the window argument anymore as a first step.
Up Topic Gosu / Gosu Showcase / Starfighter Gosu Tutorial

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill