Author Topic: Y value not affect placement in Layout.  (Read 1897 times)

mesoraven

  • Newbie
  • *
  • Posts: 8
    • View Profile
Y value not affect placement in Layout.
« on: February 15, 2022, 03:21:41 AM »
hey,

so ive been making some small modifications to the Retrodiction theme found here: http://forum.attractmode.org/index.php?topic=3199.0

ive added in a space above the games list for the game logo.

ive managed to freely modify every bit of the layout except the indicator circle. i can move it in the x axis but not matter how much i increase the y value its starting position never changes

i only started learning programming about a year ago for fun so its probably just me missing something small but any help would be appriciated.

here is the offending code as far as i can tell.

Quote
//Indicator Bar
local indicator_bar = fe.add_image( "images/indicator_bar.png", 21, 240, 12,730 );
local indicator_graph = fe.add_image( "images/indicator_graph.png", 23, 240, 8, 760 );
local indicator_position = fe.add_image( "images/indicator_circle.png", 5, 400, 42, 42 );



JonahUK

  • Full Member
  • ***
  • Posts: 32
  • Don't like what I say or how I answer? IDGAF.
    • View Profile
    • My Channel
Re: Y value not affect placement in Layout.
« Reply #1 on: February 15, 2022, 03:33:21 AM »
Code: [Select]
function on_indextransition( ttype, var, ttime )
{
indicator_graph.height = (indicator_bar.height)/(fe.list.size) * (fe.list.index+1)
indicator_position.y = (indicator_bar.height)/(fe.list.size) * (fe.list.index) +418
indicator_text.y = (indicator_bar.height)/(fe.list.size) * (fe.list.index) + 418
}

fe.add_transition_callback( this, "on_indextransition" )

That's the section of code that moves the circle in the original layout

https://github.com/randombyt/RetroDiction/blob/master/layouts/retrodiction/layout.nut

mesoraven

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Y value not affect placement in Layout.
« Reply #2 on: February 15, 2022, 04:17:52 AM »
Code: [Select]
function on_indextransition( ttype, var, ttime )
{
indicator_graph.height = (indicator_bar.height)/(fe.list.size) * (fe.list.index+1)
indicator_position.y = (indicator_bar.height)/(fe.list.size) * (fe.list.index) +418
indicator_text.y = (indicator_bar.height)/(fe.list.size) * (fe.list.index) + 418
}

fe.add_transition_callback( this, "on_indextransition" )

That's the section of code that moves the circle in the original layout

https://github.com/randombyt/RetroDiction/blob/master/layouts/retrodiction/layout.nut


Awesome thankyou, makes sense now you have pointed it out. obviously its vertical location would be based of the list rather than the objects location

JonahUK

  • Full Member
  • ***
  • Posts: 32
  • Don't like what I say or how I answer? IDGAF.
    • View Profile
    • My Channel
Re: Y value not affect placement in Layout.
« Reply #3 on: February 15, 2022, 07:01:15 AM »
Code: [Select]
function on_indextransition( ttype, var, ttime )
{
indicator_graph.height = (indicator_bar.height)/(fe.list.size) * (fe.list.index+1)
indicator_position.y = (indicator_bar.height)/(fe.list.size) * (fe.list.index) +418
indicator_text.y = (indicator_bar.height)/(fe.list.size) * (fe.list.index) + 418
}

fe.add_transition_callback( this, "on_indextransition" )

That's the section of code that moves the circle in the original layout

https://github.com/randombyt/RetroDiction/blob/master/layouts/retrodiction/layout.nut


Awesome thankyou, makes sense now you have pointed it out. obviously its vertical location would be based of the list rather than the objects location

Exactly.

Think I still have an horizontal mod of this I did a while ago somewhere. I'll see if I can find it in case anyone wants it.

EDIT:
Modified code in the "horizontal.txt" attached along with the two images it calls

Can be seen working in this video: https://www.youtube.com/watch?v=v4_EcawSvb4
« Last Edit: February 15, 2022, 07:47:38 AM by JonahUK »