Page 1 of 1
Move Object
Posted: Fri Jan 14, 2022 4:58 pm
by amyren
Is there a way to move an object around without using code?
Using the Move Object Event seem to only support using absolute X and Y coordinates, so you cant use that if you want to just move it a few pixels left or right.
Re: Move Object
Posted: Fri Jan 14, 2022 6:59 pm
by Flinx
What kind of object?
And why doesn't your program know the position of this object?
But using layers you could read the position of an object:
Code: Select all
@DISPLAY {Width = 400, Height = 300, Layers = True}
Circle(10, 10, 30, #GRAY, {Name="circle1"})
For i=1 To 10
st = GetLayerStyle("circle1")
MoveLayer("circle1", st.x, st.y, st.x+30, st.y+20,{Speed=#SLOWSPEED})
Wait(1,#SECONDS)
Next
Re: Move Object
Posted: Fri Jan 14, 2022 7:57 pm
by amyren
Flinx wrote: ↑Fri Jan 14, 2022 6:59 pm
What kind of object?
And why doesn't your program know the position of this object?
Thanks for your reply and your code sample.
Although I can use Hollywood code in Designer, I want to explore the other ways to do things in Designer.
Thats why I posted this in the Designer section of the forum, not Hollywood.
Re: Move Object
Posted: Fri Jan 14, 2022 8:57 pm
by Flinx
Sorry, I should have looked more closely at the subforum.
Re: Move Object
Posted: Sat Jan 15, 2022 10:50 am
by emeck
amyren wrote: ↑Fri Jan 14, 2022 4:58 pm
Is there a way to move an object around without using code?
Using the Move Object Event seem to only support using absolute X and Y coordinates, so you cant use that if you want to just move it a few pixels left or right.
Hello amyren.
With RMB on your object, for example an image, go to Events and select what you need (on mouse over, mouse click, etc). Click New and select the type of event from the list. You can try Animate Object or Move Object, according to your needs. You can also use Action scripts,no need to write code also if you don't want too.
In both cases you can mix several events, like wait for mouse click, or time, or to finish another animation, for example.
Re: Move Object
Posted: Sat Jan 15, 2022 4:19 pm
by amyren
emeck wrote: ↑Sat Jan 15, 2022 10:50 am
amyren wrote: ↑Fri Jan 14, 2022 4:58 pm
Is there a way to move an object around without using code?
Using the Move Object Event seem to only support using absolute X and Y coordinates, so you cant use that if you want to just move it a few pixels left or right.
Hello amyren.
With RMB on your object, for example an image, go to Events and select what you need (on mouse over, mouse click, etc). Click New and select the type of event from the list. You can try Animate Object or Move Object, according to your needs. You can also use Action scripts,no need to write code also if you don't want too.
In both cases you can mix several events, like wait for mouse click, or time, or to finish another animation, for example.
I did do that, and selecting Move Object. But the Move Object dialog does not support moving the object eg. 5 pixels, you can only set the absolute X and Y positions.
Re: Move Object
Posted: Sat Jan 15, 2022 4:55 pm
by emeck
I did do that, and selecting Move Object. But the Move Object dialog does not support moving the object eg. 5 pixels, you can only set the absolute X and Y positions.
Try Animate Object. You can move objects specifying X and Y pixels independently and relative to the starting position.
Edit: From the animate object documentation.
The following options are currently supported:
‘Move’
Here you can specify values for moving the object. You can specify separate values for the x and y axes. Please note that these values are delta values, i.e. they are relative to the current position of the object. If you enter "100" for x, the object will be moved 100 pixels to the right starting from the current position of the object. If you enter "-100" for x, the object will be moved 100 pixels to the left starting from the current position.
Re: Move Object
Posted: Sat Jan 15, 2022 5:45 pm
by amyren
Thanks, that looks to be what I was after.
I will try that.