Move Object

Anything related to Hollywood Designer goes in here
Post Reply
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Move Object

Post 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.
Flinx
Posts: 188
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Move Object

Post 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
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: Move Object

Post 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.
Flinx
Posts: 188
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Move Object

Post by Flinx »

Sorry, I should have looked more closely at the subforum.
User avatar
emeck
Posts: 169
Joined: Fri Apr 03, 2015 3:17 pm

Re: Move Object

Post 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.
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: Move Object

Post 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.
User avatar
emeck
Posts: 169
Joined: Fri Apr 03, 2015 3:17 pm

Re: Move Object

Post 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.
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE
amyren
Posts: 352
Joined: Thu May 02, 2019 11:53 am

Re: Move Object

Post by amyren »

Thanks, that looks to be what I was after.
I will try that.
Post Reply