John & I practice different ways to skin this cat...and they both work just fine!
=== in your drag-able actor after the constrain to touch Rule...
Create a rule when self.Position.X < game.Display Size.Width - game.Display Size.Width + (self.Size.Width /2) --constrainAttribute self.Position.X To: game.Display Size.Width - game.Display Size.Width + (self.Size.Width /2)
Explanation: Display Size.Width - Display Size.Width = 0 (X coordinate) and that is Left side of screenDisplay.
Create a rule for the Right side of screenDisplay boundary when self.Position.X > game.Display Size.Width -(self.Size.Width /2) --constrainAttribute self.Position.X To: game.Display Size.Width -(self.Size.Width /2)
Create rules for the Top of screenDisplay boundary this is the Display Size.Height and for the Bottom of screenDisplay boundary this is the Display Size.Height - Display Size.Height using (self.Size.Height/2)
== the Display Size Width & Height are in computer memory; as are the X & Y and width & height of actor...this way seems more efficient to me...
Comments
cheers
===
in your drag-able actor after the constrain to touch Rule...
Create a rule
when self.Position.X < game.Display Size.Width - game.Display Size.Width + (self.Size.Width /2)
--constrainAttribute self.Position.X To: game.Display Size.Width - game.Display Size.Width + (self.Size.Width /2)
Explanation: Display Size.Width - Display Size.Width = 0 (X coordinate) and that is Left side of screenDisplay.
Create a rule for the Right side of screenDisplay boundary
when self.Position.X > game.Display Size.Width -(self.Size.Width /2)
--constrainAttribute self.Position.X To: game.Display Size.Width -(self.Size.Width /2)
Create rules for the Top of screenDisplay boundary this is the Display Size.Height
and for the Bottom of screenDisplay boundary this is the Display Size.Height - Display Size.Height
using (self.Size.Height/2)
==
the Display Size Width & Height are in computer memory; as are the X & Y and width & height of actor...this way seems more efficient to me...
MH