Attract-Mode Support > Scripting

help with game indicator bar....

(1/2) > >>

jedione:
so iv seen two or three theems now that are using a bar  to indicate your
position or letter index of you rom colection

iv tried breaking the themes down to see if i could isolate just the code
but seems their all heavily tied to a lot of options config,  so it will break the theme.

all im looking for would be the most generic simple coding to make this bar
my goal is to make it into a donut, file that the themer can use and alter .

soon im hoping to release a zip file that will contain abought 20 plus donut to simplefy codeing
for many to build cool themes

hear is generic  pic of it..


thanks if you can help me.....

zpaolo11x:

--- Quote from: jedione on September 27, 2018, 06:32:35 PM ---all im looking for would be the most generic simple coding to make this bar
my goal is to make it into a donut, file that the themer can use and alter .

--- End quote ---

Well the easiest way to do it is tie the dimension of the bar to you index position, and change it in an "on transition" routine. Something like

bar.width = (fe.list.index*1.0/(fe.list.size - 1))*full_bar_size

should do the trick. Remember to put the 1.0 somewhere so that data is treated as float as not integer. I don't remember why I needed the *- 1* but try experimenting with that. To be sure that the update is always consistent I just change it for every transition, just at the beginning of the on_transition routine.

jedione:
thanks for some clues,  will have to mess with it this weekend

just a quick test with this

local blue = fe.add_image(  "blue.png", flx*0.300, fly*0.500, flw*0.400, flh*0.100 );
blue.width = (blue)/(fe.list.size) * (fe.list.index+1);

gives this error: Script Error in C:\AMarcade\layouts/bar/layout.nut - arith op / on between 'instance' and 'integer'

zpaolo11x:

--- Quote from: jedione on September 28, 2018, 07:46:45 AM ---local blue = fe.add_image(  "blue.png", flx*0.300, fly*0.500, flw*0.400, flh*0.100 );
blue.width = (blue)/(fe.list.size) * (fe.list.index+1);

gives this error: Script Error in C:\AMarcade\layouts/bar/layout.nut - arith op / on between 'instance' and 'integer'

--- End quote ---

You have to change "blue" in the last line with the actual size of the full bar, otherwise you're comparing an istance (blue) with a number (blue.width). And you have to put the update routine in the on_transmission function. Try something like this:


--- Code: ---local back = fe.add_image(  "black.png", 0, 0, 500, 50 );
local front = fe.add_image(  "white.png", 0, 0, 500, 50 );

fe.add_transition_callback( this, "on_transition" )

function on_transition( ttype, var, ttime ) {
   front.width = (back.width)/(fe.list.size) * (fe.list.index+1)
}

--- End code ---

jedione:
just want to say a big thank you!   :D

here it is working...

https://youtu.be/NpXHcEdUX1s

looking forward to releasing the donut zip file that will help others and me
to make themes with "code" snips 

case closed,  and simple just what i wanted,   

ps your theme is amazing thanks for helping the small guys

Navigation

[0] Message Index

[#] Next page

Go to full version