Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// obj_ball step event
- angle = ((angle + (1/2)) % 180);
- var arcHeight = 144;
- //gotta do this weird hack since gm:s can't handle imaginary numbers.
- if((angle >= 0) && (angle <= 45))
- {
- radius = arcHeight*sqrt(dcos(2*angle));
- tarx = (view_wview[0]/2) + radius*dcos(angle);
- tary = (view_hview[0]/2) + radius*dsin(angle);
- }
- else if((angle > 45) && (angle < 135))
- {
- radius = arcHeight*sqrt(dcos(2*(225 - (angle-45))));
- tarx = (view_wview[0]/2) + radius*dcos(angle+90);
- tary = (view_hview[0]/2) - radius*dsin(angle+90); // if u wanna have the balls "bound" instead
- // of corssing change the - to a + here
- }
- else if((angle >= 135) && (angle < 180))
- {
- radius = arcHeight*sqrt(dcos(2*(angle)));
- tarx = (view_wview[0]/2) - radius*dcos(angle);
- tary = (view_hview[0]/2) - radius*dsin(angle);
- }
- x = tarx;
- y = tary;
Advertisement
Add Comment
Please, Sign In to add comment