I want to be able to make an objects stop when it connects to an object and then using click and drag pick up the two actors stuck together. How can I do this?
create global integer RelativePositionX & RelativePositionY create global boolean IsStuck?
object1 ====== Collides with object2
Create Rule: If object1 collides or overlaps with object2 then:
*change attributes both self.motion.linear velocity.x & Y to 0 *constrain attribute game.RelativePositionX to attribute self.position.x *constrain attribute game.RelativePositionY to attribute self.position.y *change attribute IsStuck to true
Otherwise:
*change attribute IsStuck to false
object2 ====== Rule If attribute game.IsStuck is true then:
*constrain attribute self.position.x to attribute game.RelativePositionX + self.size.width + (number separating the two actors further) *constrain attribute self.position.y to attribute game.RelativePositionY (so that they are bound horizontally)
Click & Drag - not quite sure fully about the attribute for touch positions..x & y - hopefully someone else can chime in. ---------- Rule for object1 - When mouse position is inside AND mouse is down (or touch or whatever) constrain attribute self.positionX to _________ constrain attribute self.positionY to _________
Full disclosure: I only have 6 days experience total. Makes sense to me though
Comments
create global boolean IsStuck?
object1
======
Collides with object2
Create Rule:
If object1 collides or overlaps with object2 then:
*change attributes both self.motion.linear velocity.x & Y to 0
*constrain attribute game.RelativePositionX to attribute self.position.x
*constrain attribute game.RelativePositionY to attribute self.position.y
*change attribute IsStuck to true
Otherwise:
*change attribute IsStuck to false
object2
======
Rule If attribute game.IsStuck is true then:
*constrain attribute self.position.x to attribute game.RelativePositionX + self.size.width + (number separating the two actors further)
*constrain attribute self.position.y to attribute game.RelativePositionY (so that they are bound horizontally)
Click & Drag - not quite sure fully about the attribute for touch positions..x & y - hopefully someone else can chime in.
----------
Rule for object1 -
When mouse position is inside AND mouse is down (or touch or whatever)
constrain attribute self.positionX to _________
constrain attribute self.positionY to _________
Full disclosure: I only have 6 days experience total. Makes sense to me though