MAKOINFUSED'S PROFILE
MakoInfused
210
Search
Filter
Creating a Sprite Array
author=pete_mw
Your most important problem is that you're creating an array with no elements and then trying to iterate over each element. Since there are no elements, Ruby won't do anything.
Additionally, this is wrong:
$sprite_array.each {|x| x = Sprite.new}
The problem here is that 'x' isn't part of the array. It's just a name that Ruby lets you use to refer to something.
You shouldn't actually be calling each on your array at all. Probably the best way to do this is to use the array comprehension form of Array.new, which you can find discussed here:
http://www.ruby-doc.org/core-1.8.7/Array.html
Essentially, you want to write something like:
$sprite_array = Array.new(10) {|i| Sprite.new}
Replacing 10 with how many sprites you actually want.
As for the '$' sign, yes, that creates a global variable. They aren't a "waste of memory" as long as you use them, but it does look to me like what you're doing could end up landing you in a world of hurt.
What are you actually trying to achieve with this?
You must have been writing this for a long time, because this was solved more than an hour ago. Remember to refresh!
author=Zachary_Braun
That did the trick! I'll have to remember that .fill method.
Thank you for your help!
Yeah, no problem, glad I could help. Just remember to look through this website here, unless you've already been there. It can be quite handy when looking for methods to use for your code. Of course that website has more than just information on Arrays, it has pretty much everything, just browse through!
Good luck!
Creating a Sprite Array
Oh, whoops yeah that's my fault. Duh, it's because it doesn't overwrite the previous information in the array, so it's creating sprites which are only referenced by a local variable. Anyway it's even easier, you simply need to do this:
The end result is that the variable: @thespritemap, holds 16 new Sprites.
@thespritemap = Array.new @thespritemap.fill(Sprite.new, 0, 15)
Creating a Sprite Array
Yes this totally possible. However, you're using the each loop incorrectly (over complicating it). There is no need to do this:
The correct way of using this form of loop is to just do this:
Of course, this is assuming that the variable $thespritemap already had some values in it, because you're creating a sprite for each already existing value. However, if you don't have any, what you can do is add this on top of that piece of code, like so:
This would create 15 (+1) indexes in the array, then create a sprite for each empty index.
You can then refer to each sprite individually by using:
So, you can use it for something like this:
Also, I wouldn't recommend using a $ symbol as that denotes a global variable, which can be accessed from anywhere in the code (waste of memory).
$thespritemap.each {|x|, $my_sprite|x| = Sprite.new}
The correct way of using this form of loop is to just do this:
$thespritemap.each {|x| x = Sprite.new}
Of course, this is assuming that the variable $thespritemap already had some values in it, because you're creating a sprite for each already existing value. However, if you don't have any, what you can do is add this on top of that piece of code, like so:
$thespritemap.fill(nil, 0 15) $thespritemap.each {|x| x = Sprite.new}
You can then refer to each sprite individually by using:
$thespritemap[index]
So, you can use it for something like this:
$thespritemap[3].bitmap = Bitmap.new(64,64)
Also, I wouldn't recommend using a $ symbol as that denotes a global variable, which can be accessed from anywhere in the code (waste of memory).
Saving Hero ID of Actor using skill
[VX] Captions on confirmation windows (before I go reinventing the wheel)
I don't blame you, I wouldn't do it the way I described either. I tend to just make separate windows in cases like that, but it sounded like one of your requirements was that the caption and commands be in the same window.
[VX] Captions on confirmation windows (before I go reinventing the wheel)
[VX] Captions on confirmation windows (before I go reinventing the wheel)
Yeah, Window_Command doesn't have any captions as part of the window.
Although your way works, you could always just make the confirmation a separate window (inheriting from Window_Command). Then you simply make that window's graphic transparent. So, the person would just see the one window (with a caption) and the desired choices. I'm pretty sure that would be an easier way of solving this problem, no?
Although your way works, you could always just make the confirmation a separate window (inheriting from Window_Command). Then you simply make that window's graphic transparent. So, the person would just see the one window (with a caption) and the desired choices. I'm pretty sure that would be an easier way of solving this problem, no?
How to have client still running even when not selected
I'm 100% sure, I just tested to be certain.
Test Information/Results:
Unfortunately the code stops running/executing/updating the graphics (along with everything else) when the window doesn't have focus. It continues to update the audio, but I presume that this is because it actually just passes along the song to the OS (Operating System). Therefore, the OS continues to play the music until explicitly told to stop. Since no one has been able to find out at what point, or where, the code is "derailed" there is no way to prevent it from stopping, without rewriting the whole RGSS Player.
It's a shame, would have been cool to stop the music entirely, since it can ruin cut-scenes which are meant to be timed exactly. I presume that's the reason anyone would want this kind of a feature anyway.
Test Information/Results:
Unfortunately the code stops running/executing/updating the graphics (along with everything else) when the window doesn't have focus. It continues to update the audio, but I presume that this is because it actually just passes along the song to the OS (Operating System). Therefore, the OS continues to play the music until explicitly told to stop. Since no one has been able to find out at what point, or where, the code is "derailed" there is no way to prevent it from stopping, without rewriting the whole RGSS Player.
It's a shame, would have been cool to stop the music entirely, since it can ruin cut-scenes which are meant to be timed exactly. I presume that's the reason anyone would want this kind of a feature anyway.
RM2000: Attack animations and fullscreen/windowed play mode
Yeah...you definitely need a better computer... 1.6 GHz, single core? That is terribly slow. I've never heard of this problem before either.
[rm2k3] Custom Fonts
I'm fairly certain that the only way is to use Hyper Patcher, as RM2k3 doesn't support Image File Format fonts.
You can use this free, open source, software to help you make fonts though:
http://fontforge.org/
Good luck!
You can use this free, open source, software to help you make fonts though:
http://fontforge.org/
Good luck!













