Questions tagged [libgosu]

Gosu is a 2D game development library for the Ruby and C++ programming languages.

See homepage at http://www.libgosu.org/

See Ruby documentation at https://www.rubydoc.info/github/gosu/gosu/

118 questions
0
votes
2 answers

Gosu, how to detect when key is pressed?

I want to move my character left and right when the player is pressing Left cursor or right cursor. How do I detect in the update function in Gosu when a key is pressed?
fguillen
  • 36,125
  • 23
  • 149
  • 210
0
votes
1 answer

How can I detect if mouse position is over the circle position using Gosu Ruby?

I have a circle that is drawn on the window, how can I define its boundaries ? So far, I can place it in an invisible rectangle and so I detect the mouse, but this is not what I want CIRCLE_STEP = 10 def draw_circle(cx,cy,r,color) 0.step(360,…
steimo
  • 170
  • 1
  • 2
  • 10
0
votes
1 answer

Recursive math functions in Gosu #update

Is there a way to continuously add (or perform any math function continuously) in Gosu. Update is called 60 times a second. Therefore, given the following code: x = 0 x += 1 p x I would expect a continuous output of: => 1 => 2 => 3 => 4 # etc.…
JeffD
  • 71
  • 5
0
votes
1 answer

Is there a way to use the cursor to scroll through a map indefinitely using Gosu

I'm using Gosu (with Ruby version 2.5.5) to create my first game. I created a map and I want to implement scrolling with the cursor. Using Gosu example "Cptn Ruby" as a guide, I was successful to a point. Here is what I have so far. def update …
JeffD
  • 71
  • 5
0
votes
1 answer

Hover over button

I want to make a shape in gosu to have a border when a mouse hovers over it. Gosu.draw_rect(50, 50, 100, 50, Gosu::Color::GREEN, ZOrder::TOP, mode=:default) I expect the output, the shape will have a black border around it when the mouse cursor…
0
votes
1 answer

Symbol not found: __ZTINSt3__112bad_weak_ptrE

I am starting of with Ruby game developing, as a beginner I am quite unsure about the properties of the gosu. While running game.rb I encountered the following problem: Traceback (most recent call last): 3: from game.rb:1:in `
' 2: from…
0
votes
1 answer

Shape moves out of the window area

I want my shape not to go out of the window area. for example when I press the left button the shape moves out of the window area but I want it to hit the side and stay there. def update if button_down?(Gosu::KbRight) if @shape_x !=…
jack
  • 11
  • 3
0
votes
2 answers

how to find the coordinates of a triangle for the roof?

I want to put that blue triangle that is in the picture on my red house. i keep putting random number but i can not get it right. the problem is in the Gosu.draw_triangle section. people said this website will…
jack
  • 11
  • 3
0
votes
1 answer

How to run multiple commands with gosu in Kubernetes job

I am defining a Kubernetes job to run a rake task but stuck in how to write the command... I am new to K8s and trying to run a Rails application in K8s. In my Rails app Dockerfile, I created a user , copied code to /home/abc and installed rvm and…
JohnZhang
  • 191
  • 5
  • 15
0
votes
1 answer

Map image and get pixel color

I have 2 images, with same dimension and same picture, a shape. In the first image (that I show on screen), the shape is monocromatic, in the second image, shape is mapped with different color. When I move the mouse, on the image, I want to show…
Nifriz
  • 1,033
  • 1
  • 10
  • 21
0
votes
0 answers

I'm trying to incorporate scenes into my mini space shooter game but Private Method Error keeps occuring

Whenever the game reaches the draw_end method it crashes. The draw_start and draw_game methods work great but the game crashes when it reaches the draw_end and therefore the ending credits cannot be displayed. The error is are these : Traceback…
0
votes
1 answer

Trouble making random spawning enemies shoot bullets

I have figured out how to randomly spawn enemies in different locations, but I cant figure out to make some of the enemies randomly fire bullets. I created a Bullet class and a Enemy class. I use attr_reader to locate the enemies and call the x and…
0
votes
1 answer

What does include means in gosu

To use gosu in ruby program, we have to called out gosu. require "gosu" But what does include means in a gosu program. require "gosu" include Gosu what is the purpose of include Gosu in the program and what does it do.
0
votes
1 answer

Add congratulation message pong gosu

I just started learning ruby and gosu. The code I am using right now is a reference from someone else code. This is a 2 player Pong ruby game. The game is working and is able to play. I am trying to set it so that any player reach to the score of…
0
votes
1 answer

The button should have a black border around it when the mouse is moved over it to highlight it

The button should be highlighted when the mouse moves over it (i.e it should have a black border around the outside) This is how border should look like when mouse is moved around it. Button Must display a colored border that 'highlights' the…