Forum
Hmm, oh well, nice to think about anyway. You can already write cross-platform .NET games anyway :P
What this that's included in the sdk?
Actually, what libraries does Gosu use mainly for drawing and sound anyway? Because if they're not too complex, then one might be able to implement ports of them for XNA, if they don't already exist. If that's practical, then it would run on all Mono platforms as well, using MonoGame.
What makes you say that it would run very slowly? (not that I necessarily disagree)
Heheh, here's a thought: how about a Gosu port for the .NET platform? That way it could run on all the Microsoft products (Windows, Xbox 360, Windows Phone) and anything that Mono supports (OS X, IOS, Linux, Android [I think]). Just food for thought.
EDIT: That would also mean it could be used from any other .NET Runtime language, like C#, J, and F#!
(also @erisdiscord) Why not? I didn't know that... :/
Wait a minute... How could we have forgotten about JRuby?! It is a reliable solution even for distributing Ruby apps as standalone jars; the end user only has to have Java installed.
Thanks for the reply, but it's been solved on another forum. This was (mostly) my post:
---
Images can be drawn multiple times to the screen; any number of times or not at all. Take this for example:
# Lets say that my_image is a 100x100 size image, and we want to stamp it 10x10 times
for x in 1..10
for y in 1..10
w, h = my_image.width, my_image.height
# Multiply the sizes so the "stamps" don't overlap
my_image.draw(x * w, y * h, 0)
end
end
EDIT: Oh also, all the copies will stay until the screen is wiped (after each draw call)
---
The last line was his main issue.
I suggest having some sort of Tile class, and your window generates them in some clever way. You just have to call each of their update and draw methods.
As for the physics, you could look at CptnRuby as an example.
I might use this sometime; maybe you should post it as a gem.
I don't see why not, but for it to be cross-platform, you could probably use Ruby2EXE
Check on Coders' shed; I answered it there. ;)
Also, you can make your conditional shorter if you use:
elsif mouse_x.between?(0, 39) and mouse_y.between?(0, 39)
or this (parentheses only where absolutely necessary):
elsif (0..39).include?(mouse_x) and (0..39).include?(mouse_y)
[ Totally clicked the wrong button ]
" Jwosty has some error information for me here "
Ooh, I've been wanting to try this for a while!
Let's see how awesome it is :D
Yeah, I had to do that... But then again, I didn't use bundler :P
Wow, this is very impressive! I especially like the dynamic lighting :D
I meant the buildings, not the people lol xP
It's not a huge problem, just a little annoying (in my opinion).
---
Still a good game, though!
Fun game! As for having to draw the shadows in front of the buildings, you could probably fix it by making the latter translucent.
That doesn't work either... :/
------
Sorry for the long response; my internet got knocked out for a couple days by the wind.
It didn't show any highscores ingame for me (on any mode). But other than that, I think its still really fun! xD
Ah, thanks a bunch! This really helps. :D
Oh, I wrote my own short Ruby script and marked it as an executable; that's that "rubyapp" thing. Yeah, it does just load whatever version of Ruby the user has as their default; it'd be nice to try to control that sort of thing. And I don't really want to package up an entire Ruby interpreter myself; it just takes up extra space, and Macs come with Ruby installed by default.
But I think that gem environment
thing is exactly what I need! Thanks; I'll check this out (the GEM_HOME
constant, specifically).
Yeah, I'm getting that too. I wanna try this too! xP
Here's $LOAD_PATH:
/Users/alanwostenberg/Desktop/HelloWorld/HelloWorld.app/Contents/Resources/libraries
/Library/Ruby/Site/1.8
/Library/Ruby/Site/1.8/powerpc-darwin10.0
/Library/Ruby/Site/1.8/universal-darwin10.0
/Library/Ruby/Site
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby/1.8
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby/1.8/universal-darwin10.0
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/vendor_ruby
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/powerpc-darwin10.0
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0
.
And this is the error message (backticks replaced with single quotes):
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in 'gem_original_require': no such file to load -- rubydraw (LoadError)
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in 'require'
from /Users/alanwostenberg/Desktop/HelloWorld/HelloWorld.app/Contents/Resources/lib/main.rb:2
from /Users/alanwostenberg/Desktop/HelloWorld/HelloWorld.app/Contents/MacOS/rubyapp:13:in 'require'
from /Users/alanwostenberg/Desktop/HelloWorld/HelloWorld.app/Contents/MacOS/rubyapp:13
And finally, the structure of the package is attached.
This isn't
completely about Gosu, but I've been writing a simple Ruby graphics library (just for fun) (
https://rubygems.org/gems/rubydraw) based off of SDL, and I wanted to see how much it would take to be able to package it up into a nice little Mac App that could run on theoretically
any Mac. Everything is working fine and dandy, but currently the end user would have to have a few gems installed. I tried adding them to a subdirectory in Resources (entitled "Libraries"), then adding it to $LOAD_PATH. It still wouldn't work; it tries to load the gems from the gem folder. And I know it adds the completely correct directory to $LOAD_PATH; I had it print it once and it was fine. Anyone know how to do this?
Thanks!
Hmm... Yeah, I really don't know anything about how to fix things like this, to be honest. I would help you more if I could ;)
Also, I can't test it for a while today because I'm on a friend's Windows computer. I will get back to helping you as soon as I'm finished. :P
That's no big deal xP
Hmm... I just followed your instructions, but for some reason it still won't work for me. This is what it says after I build it:
Redirecting output to '/Users/*****/gosu_wrappers/alpha_channel_v1_2_3_OSX_10_6/alpha_channel.log'
<internal:gem_prelude>:182:in
path_to_full_rubygems_library': rubygems.rb (LoadError)
from <internal:gem_prelude>:162:in load_full_rubygems_library'
from <internal:gem_prelude>:217:in
try_activate'
from <internal:lib/rubygems/custom_require>:32:in rescue in require'
from <internal:lib/rubygems/custom_require>:29:in
require'
from /Users/*****/gosu_wrappers/alpha_channel_v1_2_3_OSX_10_6/Alpha_channel.app/Contents/Resources/lib/chingu.rb:28:in <top (required)>'
from <internal:lib/rubygems/custom_require>:29:in
require'
from <internal:lib/rubygems/custom_require>:29:in require'
from /Users/*****/gosu_wrappers/alpha_channel_v1_2_3_OSX_10_6/Alpha_channel.app/Contents/Resources/alpha_channel/lib/alpha_channel/game.rb:3:in
<top (required)>'
from /Users/*****/gosu_wrappers/alpha_channel_v1_2_3_OSX_10_6/Alpha_channel.app/Contents/Resources/alpha_channel/lib/alpha_channel.rb:1:in require_relative'
from /Users/*****/gosu_wrappers/alpha_channel_v1_2_3_OSX_10_6/Alpha_channel.app/Contents/Resources/alpha_channel/lib/alpha_channel.rb:1:in
<top (required)>'
from /Users/*****/gosu_wrappers/alpha_channel_v1_2_3_OSX_10_6/Alpha_channel.app/Contents/Resources/alpha_channel/bin/alpha_channel.rb:98:in require_relative'
from /Users/*****/gosu_wrappers/alpha_channel_v1_2_3_OSX_10_6/Alpha_channel.app/Contents/Resources/alpha_channel/bin/alpha_channel.rb:98:in
<top (required)>'
from /Users/*****/gosu_wrappers/alpha_channel_v1_2_3_OSX_10_6/Alpha_channel.app/Contents/Resources/Main.rb:2:in require_relative'
from /Users/*****/gosu_wrappers/alpha_channel_v1_2_3_OSX_10_6/Alpha_channel.app/Contents/Resources/Main.rb:2:in
<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in require'
from <internal:lib/rubygems/custom_require>:29:in
require'
from /Users/*****/gosu_wrappers/alpha_channel_v1_2_3_OSX_10_6/Alpha_channel.app/Contents/Resources/gosu/run.rb:11:in <main>'
Not sure who's end it is... Do you want me to upload the app for you to look at?
Ah, then there's the problem. The app hangs because while espeak is talking, your program temporarily stops updating the app. To fix this, you could thread it like so:
def update
thread = Thread.fork do
# Changed this part a bit to remove a duplicate for you
if @val == 50
$screen.speak("Bonjour")
Kernel.system('espeak -vfr "bonjour"')
end
end
thread.run
@val += 1
end
This posees on problem though: It might start speaking before it's finished. But I think you can figure that part out pretty easily. ;)
Hope this helps!
Oh also, after I rename Alpha_channel.app/Contents/Resources/alpha_channel/bin/alpha_channel.rbw
to .../alpha_channel.rb
, it spits out:
Redirecting output to '/Users/*****/Desktop/alpha_channel_v1_2_1_OSX_10_6 2/alpha_channel.log'
/Users/*****/Desktop/alpha_channel_v1_2_1_OSX_10_6 2/Alpha_channel.app/Contents/Resources/alpha_channel/lib/alpha_channel/game.rb:1:in
<top (required)>': uninitialized constant Object::RbConfig (NameError)
from /Users/*****/Desktop/alpha_channel_v1_2_1_OSX_10_6 2/Alpha_channel.app/Contents/Resources/alpha_channel/lib/alpha_channel.rb:1:in require_relative'
from /Users/*****/Desktop/alpha_channel_v1_2_1_OSX_10_6 2/Alpha_channel.app/Contents/Resources/alpha_channel/lib/alpha_channel.rb:1:in
<top (required)>'
from /Users/*****/Desktop/alpha_channel_v1_2_1_OSX_10_6 2/Alpha_channel.app/Contents/Resources/alpha_channel/bin/alpha_channel.rb:98:in require_relative'
from /Users/*****/Desktop/alpha_channel_v1_2_1_OSX_10_6 2/Alpha_channel.app/Contents/Resources/alpha_channel/bin/alpha_channel.rb:98:in
<top (required)>'
from /Users/*****/Desktop/alpha_channel_v1_2_1_OSX_10_6 2/Alpha_channel.app/Contents/Resources/Main.rb:2:in require_relative'
from /Users/*****/Desktop/alpha_channel_v1_2_1_OSX_10_6 2/Alpha_channel.app/Contents/Resources/Main.rb:2:in
<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in require'
from <internal:lib/rubygems/custom_require>:29:in
require'
from /Users/*****/Desktop/alpha_channel_v1_2_1_OSX_10_6 2/Alpha_channel.app/Contents/Resources/gosu/run.rb:11:in <main>'
I'll upload a Mac app for ya :)
-----
Haven't been able to try this for a bit; Ruby 1.9.3 installation doesn't like me and your game doesn't work with anything else. But now I finally got 1.9.3 installing correctly. Now to see if it works... xP
EDIT: Yeah, I can't get it to work at all now... :/
This is what it says when I try to run it from source (plus a nasty warning saying that libyaml isn't installed):
/Users/*****/.rvm/gems/ruby-1.9.3-head/gems/chipmunk-5.3.4.5/lib/chipmunk.rb:6: Use RbConfig instead of obsolete and deprecated Config.
/Users/*****/Downloads/alpha_channel_v1_2_2_SOURCE/lib/alpha_channel/game.rb:29:in
<top (required)>': uninitialized constant EXTRACT_PATH (NameError)
from alpha_channel.rb:1:in require_relative'
from alpha_channel.rb:1:in
<main>'
And this is what it says from the Mac app executable, after replacing all the old Alpha Channel files with the new ones:
/Users/*****/Desktop/alpha_channel_v1_2_1_OSX_10_6 2/Alpha_channel.app/Contents/Resources/Main.rb:2:in require_relative': no such file to load -- /Users/******/Desktop/alpha_channel_v1_2_1_OSX_10_6 2/Alpha_channel.app/Contents/Resources/alpha_channel/bin/alpha_channel.rb (LoadError)
from /Users/******/Desktop/alpha_channel_v1_2_1_OSX_10_6 2/Alpha_channel.app/Contents/Resources/Main.rb:2:in
<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in require'
from <internal:lib/rubygems/custom_require>:29:in
require'
from /Users/******/Desktop/alpha_channel_v1_2_1_OSX_10_6 2/Alpha_channel.app/Contents/Resources/gosu/run.rb:11:in <main>'
Not sure what any of this means.
Could you please attach your full program? It would then be much easier to debug... xP
–––––
I might know why it's doing this. Is that system('espeak...
thing the only line of code you use for the text to speech? If so, it might not exit until it is finished talking. There is a very simple fix for this, and I'll tell you if this turns out to be your problem. :)
That looks interesting... I'd really like to see how you programmed the Twitter feed!
Ooooh! That record thing sounds pretty nifty. So it's basically like getting a region from the screen and then being able to draw it?
I really like those. Awesome work :D
No problem! ;)
Sorry it took so long to reply though; I've been busy
Yeah, sure!
Also, when referencing to classes, don't prefix it with @
. This means it's an instance variable, like your score
. But using CptnRuby.score
won't work until you define that method. It isn't defined right now. Fixing this right now for you; I'll attach it when done. Should take longer than a minute total. :)
Well I assume you want to be able to run it by double-clicking on the file like you would an executable. If so and you're on a Windows computer, you should already be able to do just that. If not, then try writing a shell script for it. Need an example?
Tried this and it didn't exit with any errors. When I played it, the collisions were WAY off... Do you want me to attach the fixed file?
As for the first problem, I figured out that the problem code is in line 226. It happens because you never set @CptnRuby
to anything, so it is nil
by default. And, you never even define a score
method anywhere, so it says that you never defined it for nil
. Perhaps you meant to type @score
?
----
I'll try this in a second and see what I get.
Huh, didn't find anything. I'll try looking at it through IntelliJ
Wow. Twice in a row someone beats me to posting :P
Awesome, looking for a problem. Also, you know you can attach files directly to your post after you post it. ;)
Okay, that clears it up. Progress sounds great!
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill