Author Topic: robospin Conveyer Wheel help  (Read 1350 times)

SpoonyAllen

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
robospin Conveyer Wheel help
« on: February 02, 2021, 11:44:21 AM »
I'm new to attract mode coming from hyperspin. I need to use attract because of two features it has that HS does not. I had a basic vertical setup on HS that i would like to make something similar using attract mode. I copied, pasted and edited a bit of code from Robospin in order to make a basic vertical theme. now my issue is, i have been looking at the conveyer code in order to position and have the wheels move from left to right at the top of a vertical layout.

Does anyone know how to accomplish this? Any help you can offer would be greatly appreciated. for some reason the forums doesn't like the nut code in a code tag so i uploaded it to pastebin: https://pastebin.com/kCf0bxDP

A visual of what i want to do here:
« Last Edit: February 02, 2021, 12:13:42 PM by SpoonyAllen »

mahuti

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
    • View Profile
    • Github Repositories
Re: robospin Conveyer Wheel help
« Reply #1 on: February 02, 2021, 03:10:40 PM »
I made a very simple version of this to remove (most) of the extra stuff.

I used my module Pos (positioning) module and a slightly modified Carrier module (by Oomek) that basically just adds the capability to use wheel logos instead of snaps.

Carrier does all of the work with the wheel stuff at top. All of the scale.x, scale.y, scale.width, etc just made it quicker for me to position everything for an example. You can swap that out with hard coded values if it's easier.
« Last Edit: February 02, 2021, 03:12:20 PM by mahuti »

SpoonyAllen

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Re: robospin Conveyer Wheel help
« Reply #2 on: February 02, 2021, 04:37:07 PM »
I made a very simple version of this to remove (most) of the extra stuff.

I used my module Pos (positioning) module and a slightly modified Carrier module (by Oomek) that basically just adds the capability to use wheel logos instead of snaps.

Carrier does all of the work with the wheel stuff at top. All of the scale.x, scale.y, scale.width, etc just made it quicker for me to position everything for an example. You can swap that out with hard coded values if it's easier.

that's awesome. I was slowly looking and prodding at the conveyer module. I haven't messed with Carrier just yet. Is there any way you can share your nut and modified carrier?

progets

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1180
    • View Profile
Re: robospin Conveyer Wheel help
« Reply #3 on: February 02, 2021, 05:15:30 PM »
Is there any way you can share your nut and modified carrier?

It's in his post above.

basic vertical.zip

P.S. Conveyor.nut and carrier.nut both do similar things, move titles/wheels around. They are written by different people but it's an either/or thing, there isn't a need for both in a layout.
« Last Edit: February 02, 2021, 05:21:31 PM by progets »

mahuti

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
    • View Profile
    • Github Repositories
Re: robospin Conveyer Wheel help
« Reply #4 on: February 02, 2021, 07:03:46 PM »
Hard to notice the file... its right above the pic.

I didn't use conveyor mostly because I don't have a code sample handy that uses it. And carrier is nice and smooth.

SpoonyAllen

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Re: robospin Conveyer Wheel help
« Reply #5 on: February 03, 2021, 07:35:41 AM »
thanks so much for this. yeah the attachment was a little tricky to spot.

Is there a way to add text at the bottom to show the game title? I tried a few variations of code to get text to show up at the bottom but nothing shows up. Even tried pasting in a a simple

Code: [Select]
fe.add_text( "[Title] - [Year] - [Manufacturer]", flx*0.05, fly*0.949, flw*0.6, flh*0.04  );
but get nothing to show up? Maybe I'm just having a brain fart somewhere?

edit:

got this working for the game title, manufacturer text. Just can't seem to align it to the bottom of the menu
Code: [Select]
local title = fe.add_text( "[Title] - [Year] - [Manufacturer]", 0, 1, fe.layout.width, 35 )
title.text_align = Align.BottomRight;
title.set_rgb( 255, 255, 255 )
title.style = Style.Bold;
title.background = "frameb.png"
« Last Edit: February 03, 2021, 08:40:06 AM by SpoonyAllen »

mahuti

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
    • View Profile
    • Github Repositories
Re: robospin Conveyer Wheel help
« Reply #6 on: February 03, 2021, 09:49:12 AM »
Code: [Select]
local title =  fe.add_text( "[Title] - [Year] - [Manufacturer]", 0, your_menu_object.y + your_menu_object.height + 10, fe.layout.width, 35 )
or using my positioning module...

Code: [Select]
local title =  fe.add_text( "[Title] - [Year] - [Manufacturer]", 0,0, fe.layout.width, 35 )
title.y = scale.y(5,"top",title,your_menu_object_name,"bottom") // this sets the y coord of the top of title object 5 pixels from the bottom of the menu object

Maybe something like that. Use the height of the menu object and its y position to find the bottom of it. If you're using carrier or conveyor though, it may render a surface across the whole screen (not sure) so the x/y values might be useless in determining the correct visual positioning. In that case, you'll just have to position your title's y position so it doesn't overlap.

SpoonyAllen

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
Re: robospin Conveyer Wheel help
« Reply #7 on: February 03, 2021, 10:24:19 AM »
Code: [Select]
local title =  fe.add_text( "[Title] - [Year] - [Manufacturer]", 0, your_menu_object.y + your_menu_object.height + 10, fe.layout.width, 35 )
or using my positioning module...

Code: [Select]
local title =  fe.add_text( "[Title] - [Year] - [Manufacturer]", 0,0, fe.layout.width, 35 )
title.y = scale.y(5,"top",title,your_menu_object_name,"bottom") // this sets the y coord of the top of title object 5 pixels from the bottom of the menu object

Maybe something like that. Use the height of the menu object and its y position to find the bottom of it. If you're using carrier or conveyor though, it may render a surface across the whole screen (not sure) so the x/y values might be useless in determining the correct visual positioning. In that case, you'll just have to position your title's y position so it doesn't overlap.

ironically i was looking at your positioning module right now. :D

I did cobble something up earlier similar to what you posted but it didn't work and would set me back to another working theme. I'll give your example above a shot. thanks!

mahuti

  • Administrator
  • Sr. Member
  • *****
  • Posts: 252
    • View Profile
    • Github Repositories
Re: robospin Conveyer Wheel help
« Reply #8 on: February 03, 2021, 01:07:32 PM »
Basic positioning should be straightforward.  Positioning relative to something else is going to be harder, especially depending on what you use.

This is some basic code on scaling relative to carrier using my positioning stuff.
Code: [Select]
local carrier_width = 1079
local carrier_height = 1080
local x_center = scale.x(0,"center",carrier_width)
local y_center = scale.y(0,"center",carrier_height)
local carrier = Carrier( x_center,0 , scale.width(carrier_width), scale.height(carrier_height), 1, 6, 220,"transparent.png","transparent.png" )
carrier.set_keep_aspect()

print("carrier x: " + carrier.surface.x )
print("carrier y:" + carrier.surface.y )
print("carrier width: " + carrier.surface.width )
print("carrier height:" + carrier.surface.height )

local test_image = add_image("test.png", 0,0,100,100)

test_image .y = scale.y(10,"top",test_image , carrier.surface,"bottom") // this would line up the top of the test image with the bottom of the  carrier surface using my positioning stuff

// or...

test_image.y = scale.get_object_xy2("y", carrier.surface) // same basic thing as above.



« Last Edit: February 03, 2021, 01:09:48 PM by mahuti »