|
|
Search Tutorials
Here is the action script code.
Set Variable: "red_x" = GetProperty ("/red",_x)
Set Variable: "red_y" = GetProperty ("/red",_y)
Set Variable: "green_x" = GetProperty ("/green",_x)
Set Variable: "green_y" = GetProperty ("/green",_y)
Set Variable: "red_h" = GetProperty ("/red",_height)/2
Set Variable: "green_h" = GetProperty ("/green",_height)/2
Set Variable: "red_w" = GetProperty ("/red",_width)/2
Set Variable: "green_w" = GetProperty ("/green",_width)/2
Set Variable: "distance_x" = red_x-green_x
Set Variable: "distance_y" = red_y-green_y
Set Variable: "area" = (red_h+red_w)*(green_h+green_w)
If (distance_x*distance_x+distance_y*distance_y<=area)
Set Variable: "/:status" = "Collision Detected"
Else
Set Variable: "/:status" = "No Collision Detected"
End If
|
||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||
|