How do you transfer a variable value to another variable? (Solved)

Sorry for the late reply butt yeah i have been trying to keep everything simple
by the way do you know any tutorial on how to make a scroller to scroll multiple object?

I’m not sure what you mean. Gdevelop has a lot of built-in tutorials and examples. They also have a lot on YouTube.

The outlined part and i did searched but couldn’t find anything

Which part is scrolling? All of it or just parts?

The center buttons for buying stuff goes up and down

One way would be to use the object masking extension. Put the object that you want to scroll on their own layer, along with a background object and mask sprite. The slider and any non-moveable object would be on a different layer.

This code needs work. But I hope it shows a way.

try me:

project: (click the green [code] button and select download zip.

The slider math is sloppy. That could be simplified. I’m tired.
It disables the buttons when the mouse is outside of the background so buttons that aren’t visible can’t be clicked. I assigned random numbers to the text just to provide random text.

This could be designed in the editor or from an array at runtime.

Thank you very much!! it is working :smiley:

1 Like

Sorry i am bothering you again but this part is not working in mine but it is working in yours

I didn’t really like how I wrote that part. I thought about just leaving that object on a layer that didn’t move but for whatever reason, I wanted to try to limit the layer count. I was also unsure of how the masking behaved with objects on different layers. Anyways…

Is bgforcp on the CropPlacing layer?
Is the action to keep it in place also the same. I set the y() to starting position + the slider that is set to a variable at the beginning of the scene.

You can skip the variable and use the value in the scene editor but I like to use a variable as an offset so I can make changes in the editor and not have to change any events.

Check that it’s pointing the y(), into a variable
Check that under the slider event it’s changing the y to the start variable + the slider
Check that it’s on the layer.

Is bgforcp on the CropPlacing layer?

yes it is i even tried moving it on another layer where the buttons are but still same result


with this code the entire background sprite moves and the buttons work even outside it

changing the events to this everything works fine the background doesn’t move but the buttons still work outside the background

bgforcrcp in my example would be on the same layer as the layer that gets moved or the camera moves. I used the offset to keep the mask object in the same place on the screen while moving the contents or camera.

To activate/deactivate the interaction, the mouse would need to check the x,y on the same layer meaning if bgforcrcp is on CropPlacingButtons then it needs to use the same layer as reference meaning CropPlacingButtons

That should fix thing. Fingers crossed.

I did as you said and still nope the buttons are still working outside the background.

If my example works then I would just compare the 2 projects and make sure everything is on the right layer.

I don’t know what else to suggest. There’s not much to it.

You are right just the only difference is the button type i am using toggle buttons
but i will try lol to figure out what is going wrong😅

1 Like

It can be tough. I tried doing something the other day and I still don’t know why it didn’t work.

Often it’s a typo with a variable name, sometimes just capitalization. Other times, I forget to put all the objects into a group.

How about posting the most recent version of your events.

If you’re still stuck, if you put your project on a file sharing site I can take a lot at it.



The first image is an event for toggling buttons
and rest you know it lol
and i tried doing things here and there but no result

I can’t see anything wrong. I’m willing to look at your project if you want/can put onto a filesharing site.
The only thing left is the object layer names or object hitbox. Are you using the most recent version of Gdevelop? they had an issue with the automatic hitbox. I’m not sure if you’re familiar with the debug action to show the hitboxes. You can try adding it. Also make sure everything is in the group.

ScreenRecorderProject5_1

i created a file with the same method as the main file and it is having the same problem
i think it is the toggle button mechanic

What is this? Is this so only 1 toggle can be selected at a time? I didn’t look at it. You would need the same logic as the code that enables the interactions. Actually, you wouldn’t need interactions, so they can be disabled.

image
.
I rearranged things a bit to prevent more than 1 button from being pressed at the same time. There might be a better way but this works. It might need further testing. It’s tough to check for every scenerio.

The issue was the [inverted] on button. If more than 1 button was pressed then it wouldn’t uncheck them. I think this works for both clicking and dragging. And with the interactions being disabled, you wouldn’t need the part that enables and disables the interactions for the toggle buttons.

Finally it is working!!
the toggle button mechanic was the problem
Thank you very much!!

1 Like