problem with object position

Robin_Gravel [attachment deleted by admin]
Brian_Provinciano You should never modify the properties manually.

Always do:

(TheActor:posn( x y ))

never:

(TheActor:x( x ))
(TheActor:y( y ))
Robin_Gravel First. The object was not an actor but a prop. A mistake from me. Anyway it doen't work. I tried it.

The object is still at the left screen.

(instance espace1 of Prop
(properties
y 135
x 10
view 8
)
)

Robin Gravel
Brian_Provinciano It's the same for actors and props.

Your problem is that unlike AGI, the x,y is not the bottom left corner, it's the bottom center point.

For example, if your view is 50x50 pixels, to have it as 0,0 you would need to position it at 25,50. To have it at 25,25 you would need to position it at 50,75. To have it at 10,135 you would need to set it's position as 35,185 etc.
Robin_Gravel All right. I changed x to 33. It works like a charm.
My object was 50x70.

So the object's position may vary according the number
of the object's pixels?

(instance theKey of Prop
(properties
y 160
x 160
view 400
)
)

I found this commands from the tutorial about the key. So why didn't you used the (theKey:posn( x y )) unstead?

Robin Gravel

Brian_Provinciano When initializing the object, you do:

(instance theKey of Prop
(properties
y 160
x 160
view 400
)
)

but when changing the object at runtime you don't do:

(theKey:x( 160 ))
(theKey:y( 160 ))

but rather:

(theKey:posn( 160 160 ))

I thought you meant that's what you were doing.

Like I said, the x is the center of the view, so if it's 100, it would be 50, if it's 200, it would be 100, etc. So it does change from view to view, but you will find this works much better than AGI in the long run.
Robin_Gravel [attachment deleted by admin]