nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,987
Reaction score
3,120
First Language
French
Primarily Uses
RMMV
Hi I work on a title screen and I wanted to know how I can exemple making  "Layers" in my title screen 

In simple I want to offer to people to having a unlimeted amount of picture he can dispose in title screen

the configuration I want to make is like this 

Layers = {# layer number => [ "layers filename",ox,oy,movement_x,movement_y,movement_angle,animated,refresh if out of viewport ],1 => ["layers1",10,10,0,0,0, false,true ],}but its how to force the input of the layers I don't know the rest I can handle this by myself but the specific spot is

"force them to put on the screen"

thanks for your further answer
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
7,166
Reaction score
10,538
First Language
Indonesian
Primarily Uses
N/A
You can do

@sprites = []Layers.each do |layer_num, data| spr = Sprite.new spr.z = layer_num # define other data here @sprites << sprendYou should include the instruction that the layer number should be number (obviously) and need to be different each other
 

♥SOURCE♥

Too sexy for your party.
Veteran
Joined
Mar 14, 2012
Messages
693
Reaction score
411
Primarily Uses
Hello there, nio.

Why do you want to use hashes? An array would work just fine:

Layers = [ ['background', 0, 0, 4, 0, 0, false, false], ['layers1', 10, 10, 0, 0, 0, false, true]]Then you would just need to iterate through it and create the layers, maintaining the order thanks to the element index in the array:

@layers = []Layers.each { |layer| sprite = Sprite.new sprite.bitmap = Cache.picture(layer[0]) # Pushes Sprite object and layer data into the layers container. @layers << [sprite, layer]}Then, you would have to update each one accordingly to the information saved alongside the Sprite.

@layers.each { |layer| sprite, file, ox, oy, movex, movey, move_ang, anim, refr = *layer # Do your stuff using that information.}Cheers.
 

nio kasgami

VampCat
Veteran
Joined
May 21, 2013
Messages
8,987
Reaction score
3,120
First Language
French
Primarily Uses
RMMV
You can do

@sprites = []Layers.each do |layer_num, data| spr = Sprite.new spr.z = layer_num # define other data here @sprites << sprendYou should include the instruction that the layer number should be number (obviously) and need to be different each other
haha sure I will specify how to use the layers but thanks for sharing but I will take Science method  : 3 

Hello there, nio.

Why do you want to use hashes? An array would work just fine:

Layers = [ ['background', 0, 0, 4, 0, 0, false, false], ['layers1', 10, 10, 0, 0, 0, false, true]]Then you would just need to iterate through it and create the layers, maintaining the order thanks to the element index in the array:

@layers = []Layers.each { |layer| sprite = Sprite.new sprite.bitmap = Cache.picture(layer[0]) # Pushes Sprite object and layer data into the layers container. @layers << [sprite, layer]}Then, you would have to update each one accordingly to the information saved alongside the Sprite.

@layers.each { |layer| sprite, file, ox, oy, movex, movey, move_ang, anim, refr = *layer # Do your stuff using that information.}Cheers.
ho my thanks this seem far more logic then my old method who was really messy and I used hash because i how I learned by check moghunter script so...

and Hash and array are two things I have big difficulty for the moment but thanks I will be sure to thanks you for this!

-------------------------------------------------------------------------------------------------------

thanks you people you remove a lot in pain in the back by helping me : 3 !

now I can concentrate on other stuff!
 
Last edited by a moderator:

Latest Threads

Latest Posts

Latest Profile Posts

So... me, always ALWAYS late.. have started reading the One Piece manga. So far I'm impressed with it. It's definitely a fun read. The only thing I need to get used to is every... single... character having a flashback story. Wifey is a huge fan and she's asked me to draw Nami and Boa Hancock for her. So I may post those drawings here XD
My brother makes some inane complaint about one of my stories in the comment section. My mom: if your bro doesn't understand it make it simpler. That prolly means others have questions too.☺️Me: Sorry. I can't do that. I don't speak stupid.
If you are ever looking for your cat among a room full of identical looking cats just find the one that is doing it's best to ignore you.
Isn't "tableau" such a fun word to say? Even better is that our resident artists know what it means without google and probably get to say it regularly.
ScreenShot_3_27_2023_4_30_39.png
one of the benefits of doing almost all the assets myself is being able to add my friend's OC from his comic book into my game as an NPC.

Forum statistics

Threads
129,894
Messages
1,206,047
Members
171,074
Latest member
BleedingBrimstone
Top