Community

SCI Programming => Mega Tokyo SCI Archive => Topic started by: robingravel on August 07, 2002, 06:48:33 PM

Title: problem with object position
Post by: robingravel on August 07, 2002, 06:48:33 PM


[attachment deleted by admin]
Title: Re:problem with object position
Post by: Brian Provinciano on August 07, 2002, 06:52:46 PM
You should never modify the properties manually.

Always do:

(TheActor:posn( x  y ))

never:

(TheActor:x(  x  ))
(TheActor:y(  y  ))
Title: Re:problem with object position
Post by: robingravel on August 07, 2002, 07:25:28 PM
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
Title: Re:problem with object position
Post by: Brian Provinciano on August 07, 2002, 07:51:27 PM
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.
Title: Re:problem with object position
Post by: robingravel on August 07, 2002, 08:17:39 PM
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

Title: Re:problem with object position
Post by: Brian Provinciano on August 07, 2002, 09:06:45 PM
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.
Title: Re:problem with object position
Post by: robingravel on August 07, 2002, 09:15:45 PM


[attachment deleted by admin]