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?
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,…
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.…
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
…
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…
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…
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 !=…
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…
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…
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…
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…
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…
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.
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…
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…