Author Topic: problem with object position  (Read 2021 times)

0 Members and 1 Guest are viewing this topic.

Offline robingravel

problem with object position
« on: August 07, 2002, 06:48:33 PM »


[attachment deleted by admin]



Offline Brian Provinciano

Re:problem with object position
« Reply #1 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  ))

Offline robingravel

Re:problem with object position
« Reply #2 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

Offline Brian Provinciano

Re:problem with object position
« Reply #3 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.

Offline robingravel

Re:problem with object position
« Reply #4 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


Offline Brian Provinciano

Re:problem with object position
« Reply #5 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.

Offline robingravel

Re:problem with object position
« Reply #6 on: August 07, 2002, 09:15:45 PM »


[attachment deleted by admin]
« Last Edit: August 07, 2002, 10:36:00 PM by Robin_Gravel »


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.037 seconds with 17 queries.