help needed with squares not overlaping

when you move them around are you calling that:

if hasCollieded(square1, square2) then  

again? You have to check it every time you move an object. This is something you would probably put inside your move code.
[import]uid: 199310 topic_id: 35570 reply_id: 141796[/import]

i still can not get it
and how would i put both of the squares into one handler?
thanks for any help [import]uid: 218976 topic_id: 35570 reply_id: 142603[/import]

event.target is the square you are moving. I would consider re-writing this so that your squares (since you have at least 3) and put them in an array, then you could use the same function for each square and loop over the array. [import]uid: 199310 topic_id: 35570 reply_id: 142693[/import]

i tried to put it everywhere but it still would not work right. can you maybe use some of my code and show me an example or explain it in simpler way for me to understand it better.
what i want to do is have all of the squares move but not overlap if there is a square in that space already

thanks [import]uid: 218976 topic_id: 35570 reply_id: 142341[/import]

Put it either just below this line:

 if e.phase == "moved" then  
 if hasCollided(event.target, redSquare) then   
 print("Squares overlap")  
 end  
 if hasCollided(event.target, whiteSquare) then   
 print("Squares overlap")  
 end  

It looks like you have different handlers for different squares, so you will probably need to repeat this changing out the squares as necessary in your other event handler. [import]uid: 199310 topic_id: 35570 reply_id: 142379[/import]

i still can not get it
and how would i put both of the squares into one handler?
thanks for any help [import]uid: 218976 topic_id: 35570 reply_id: 142603[/import]

event.target is the square you are moving. I would consider re-writing this so that your squares (since you have at least 3) and put them in an array, then you could use the same function for each square and loop over the array. [import]uid: 199310 topic_id: 35570 reply_id: 142693[/import]

event.target is the square you are moving. I would consider re-writing this so that your squares (since you have at least 3) and put them in an array, then you could use the same function for each square and loop over the array. [import]uid: 199310 topic_id: 35570 reply_id: 142693[/import]

event.target is the square you are moving. I would consider re-writing this so that your squares (since you have at least 3) and put them in an array, then you could use the same function for each square and loop over the array. [import]uid: 199310 topic_id: 35570 reply_id: 142693[/import]