Ok, thank you ! I'd still wait for someone more used to Chipmunk to answer the 2. and 3. that are the two question I could not make an answer myself, and that can mess up the game if I tried something different.
I came back to gosu, and try for the first time to use chipmunk in order to help me to detect collision (developing a very basic shmup, just to see if I can do it).
And the example/tutorial given with gosu left me quite perplex about certain things :
1. Wouldn't it be better/more logic to create a body and a shape in the constructor of the sprite object than in the MainWindow constructor?
2. Talking about creating shape, the example says "You need to define the vectors so that the "top" of the Shape is towards 0 radians (the right)" but then, the vectors are defined forming a triangle fitting the image of the ship exactly like it is, i.e. with the "top" on the top, so I don't understand.
3. Still about defining shape, the first vector defines the bottom-left vertex. I search other tutos/forums speaking of that point, and it seems to always start with the bottom-left then going counter-clockwise. Is it a reason for that, or could we start from whatever vertex we want, as long as we keep going counter-clockwise ?
4. The exemple use "@space.add_collision_func(:star, :star, &nil)" to tell stars not to collide with each other. As the game uses collisions only to take actions like killing sprites, increasing scores etc... that are game logic, and not to use chipmunk physics calculations, couldn't we simply set "shape.sensor" to true (As the documentation of chipmunk says "sensor – true or false: A Boolean value if this shape is a sensor or not. Sensors only call collision callbacks, and never generate real collisions.") for all the sprites and just bother for collision functions between those who should interact ?
I know those questions should sounds totally basics to people used to chipmunk, but as a beginner, I found the documentation and tutorials quite opaque.
Ok ! Done and works fine (I didn't know how to install ancient version of a gem... maybe should I go looking for tutos that tells how to use the console, and gem)! The music is now playing correctly as well, so it seems you were right in the other topic I mentioned, when you thought the stuttering was a problem with OpenAL. Thank you Julian !
Hi, I'm back on Ruby/Gosu since a few days and have encounter some errors (like with Open GL).
To resolve them, I had installed latest versions of Open Gl and realtek drivers, as latestessts of Ruby and Gosu, with the gem. it worked fined, except for the sound that stuttered. On the forum I encountered a subject close to my problem that says to try version 7.33 (the latest before OpenAL).
I downloaded this version and manually installed the file Gosu.lib in the directory Ruby1.9.3\lib\ruby\site_ruby\1.9.1\i386-msvcrt
But since then, the command line : require 'gosu' doesn't work anymore.
I tried 'gosu', 'gosu.so', 'gosu.for_1_9.so', it always returned me : C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
require': cannot load such file -- gosu (LoadError)require'
from main.rb:1:in `<main>'
I wondered if it was a path problem and asked for $LOAD_PATH, but the path to i386-msvcrt was in the list.
I can't think of an other solution and am tired to search on the web. Can someone please help me ?
Ok, thank you, it seems that the to_i method was the solution.... but there should be other bugs in my code (in other methods), as it still don't work.
And thank you also to inderictly told me why the rest of the code didn't worked when I tried to pass it in the button_down(id) method => I hadn't realized that the "id==ButtonConstant" must be the first condition tested, then the case statement could be tested.
Thank you again, and 'til next time if ever I can't figure out by myself how to make my game work !
Hi everybody !
I'm new in programming, and have decided to develop a little game with Ruby + Gosu (a bejeweled clone) on Windows 7 and I need use of the mouse.
I've already figured that the best way to use the mouse clicks in the game is in the update method, with a case statement.
The problem is when I want to set the reaction of clicking on a pawn here is my code :
then self.selectpion((mouse_x-5)/64, (mouse_y-5)/64)
#other instructions that works well
selectpion is a method that require the line and column index for a 2D array as arguments. But it seems that in this code, (mouse_x-5)/64 don't return an integer, but a range : (0..7) (and the same for mouse_y).
And it would be fastidious to detail the 64 cases for the selection of the pawns.
Can anyone tell me how to deal with it (or provide me a link for a code that would solve my problem) ?
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill