Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Forum
Search
Topic Useful tools for game development By Cassy Date 2016-02-12 04:31
Nice, didn't know that one, thanks, it's going to help me a lot for my game :)
Topic No Sound? Help T.T By Cassy Date 2014-12-08 23:24
I'm not sure if this will help you, but I had a similar problem when I started with gosu.

I followed the Gosu tutorial, and tried to add some songs to the game. It said it has to be .wav, but I converted them (I had them in .mp3) and didn't play (or at least, didn't sound).

What I did to solve it was coding the songs and sounds I wanted to use in .ogg format. The oggs played really nice.

Have you tried this?
Topic Scrolling Background By Cassy Date 2014-11-19 19:09
Thanks to both, that made thing clearer, and gave me a few ideas :)
Topic Scrolling Background By Cassy Date 2014-11-13 23:19
I know this is an old thread, but reading it made me think about something.

I didn't understand the translate function on CptnRuby example, so when I wanted to use a Scrololing Background on my game, I had to figure it out myself.

But, is the translate function only for map scrolling, or also for background scrolling?

I never thought there could be a difference at all. But maybe the translate thing could help me. In my game, I have an infinite scrolling background: 2 layers, one with the sky, and other with clouds, both running at different speeds, so it has the effect of distance. I defined a class for creating any layer of infinite scrolling:

class Layers < Gosu::Image
attr_reader :vel

  def initialize(image, imagewidht, vel, x, y, z)
        @layer2_image = Gosu::Image.new($window, image, true)
        @layer2_image2 = Gosu::Image.new($window, image, true)
        @x = x
        @xt = @x
        @yt = y
        @vel = vel
        @z = z
        @iw = imagewidht
  end

  def draw
    @layer2_image.draw(@xt, @yt, @z)
    @layer2_image2.draw(@xt + @iw, @yt, @z)
  end

  def update
    @xt -= @vel
     if @xt <= -@iw then @xt = @x end
  end
end

And you call it like this:
  @layer1 = Layers.new("bgLayer1.png", 800, 1, 0, 0, 1)
  @layer2 = Layers.new("bgLayer2.png", 800, 3, 0, 0, 2)


But now I want to put a terrain and other things that are unique, and doesn't require an infinite scrolling, so translate would be the choice then?
Topic no more than 2 simultaneous inputs? By Cassy Date 2014-11-03 19:56
Thanks for the link, that was a really interesting read. It's useful to know about gosthing and jamming :)

I still have some questions about it, I may look a little further into it later. For example, I recalled why I used Z key in the first place, and it was because that's the default key for shooting on the Touhou series. I played  Touhou 6 before posting, just to be sure, and I was right: you use arrows to move, Z to shoot, and X to bomb; but the game didn't have any trouble handling all the inputs (and I'm using the same keyboard).

I even tried to force a jamming, but I couldn't (with 2 arrows + shooting, or even 2 arrows + another key + shooting). So that makes me think the game itself has something to do with the handling. Certainly a point I want to research a little more.

Thanks again :)
Topic no more than 2 simultaneous inputs? By Cassy Date 2014-11-01 17:59
Thanks for your answer. I just tried it, and these are my results:

First, I changed " if button_down? Gosu::KbZ" for " if button_down? Gosu::KbSpace", and the player could go 7ways while shooting (it couldn't go northwest).

Then I tried with " if button_down? Gosu::KbLeftShift", and then it could go 8way while shooting. At last :)

Thanks a lot, I would never thought the problem would be the keyboard itself. Go figure.
Topic no more than 2 simultaneous inputs? By Cassy Date 2014-11-01 04:22
Good day, everyone.

I'm working on a shooter project (you know, another classic 2d sh'mup) merely as a way to learn to program games with Ruby (and Gosu of course).

I'm really enjoying my experience, so I try to figure out every problem I come across. But, unfortunately, I don't have the slightest idea what to do with this. I already made a search on the forums, but I didn't find a similar post (maybe there is, but I overlooked it).

Long story short, I have my standard ship, which can move up, down, left, right, and shoot. Here's the code for the update method of the Player class (which is passed to the main window through a manager):

def update
    @x = @last_x  if @x < 0 || @x > $window.width
    @y = @last_y  if @y < 0 || @y > $window.height
    @last_x, @last_y = @x, @y
 
  if button_down? Gosu::KbLeft or button_down? Gosu::GpLeft then izquierda end
  if button_down? Gosu::KbRight or button_down? Gosu::GpRight then derecha end
  if button_down? Gosu::KbUp or button_down? Gosu::GpUp then arriba end
  if button_down? Gosu::KbDown or button_down? Gosu::GpDown then abajo end
  if button_down? Gosu::KbZ or button_down? Gosu::GpButton1 then fire end
  end

I used "button_down?", because I need that the player keeps moving as along as I press the direction, and keeps shooting while holding down the Z key. When I test it, it does well, I can press 2 directions and it goes in angles (8 ways). And if I press 2 opposing keys, the player stays in place (as expected). If I shoot, the bullets keep coming.

The problem is, that it seems that Gosu can't handle more than 2 inputs at the same time, because if I'm not shooting, player can move 8-way, but if I'm shooting, thent player can only move 4 way. In other words, while I'm holding the Z button, the game only recognizes one other button, one of the arrows. This is a problem, because on a sh'ump you need to dodge enemy bullets from any direction, and that means you have to be able to move 8 ways while shooting.

So, the question is: is there a way to solve this? can I make Gosu to handle both things (8way move + shooting) at the same time?

Thanks in advance for any answer.

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill