Pages: [1]
  Print  
Author Topic: move_contact_solid();  (Read 3121 times)
Offline (Male) RetroX
Posted on: August 10, 2008, 09:56:37 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Here's a temporary solution:
Code: [Select]
var i, error, x2, y2;
i=0;
error=false;
x2=x;
y2=y;
while(place_free(x2+cos(degtorad(argument0)),y2-sin(degtorad(argument0))))
 {
 if i<=argument1
  {
  x2+=cos(degtorad(argument0));
  y2-=sin(degtorad(argument0));
  i+=1;
  }
 else
  {
  return false;
  error=true;
  break;
  }
 }
if error=false
 {
 x=x2;
 y=y2;
 }
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Female) serprex
Reply #1 Posted on: August 17, 2008, 03:42:36 PM
Smooth ER
Developer
Joined: Apr 2008
Posts: 106

View Profile WWW
Retro, you really need to learn to precompute
Code: [Select]
var i,error,co,si;
co=cos(degtorad(argument0)),
si=-sin(degtorad(argument0));
while(place_free(x2+co,y2+si)&&i<=argument1){
x+=co;
y+=si;
i+=1;
}

Funny how you had code after a return statement
« Last Edit: September 11, 2008, 05:19:32 PM by serprex » Logged
Offline (Male) RetroX
Reply #2 Posted on: September 05, 2008, 06:10:51 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
return doesn't end the script.  exit does.  And I'm sorry I wasted less than 10 bytes of your space and less than 1 nonosecond of your time. >_>
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) sprintf()
Reply #3 Posted on: September 06, 2008, 08:09:34 AM

"Past Contributor"
Location: S. Wales
Joined: Apr 2008
Posts: 72
MSN Messenger - dmgoron@gmail.com
View Profile Email
return doesn't end the script

If that's true...

Well fuck GML.
Logged
Offline (Male) Rusky
Reply #4 Posted on: September 06, 2008, 11:51:17 AM

Resident Troll
Joined: Feb 2008
Posts: 960
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
... doesn't return end the script in ENIGMA anyway, seeing as it's converted to C?
Logged
Offline (Male) RetroX
Reply #5 Posted on: September 13, 2008, 04:02:09 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
I don't know C, so I put it in there in case.  It doesn't mess it up if it does.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Josh @ Dreamland
Reply #6 Posted on: December 06, 2009, 10:25:30 AM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2934

View Profile Email
It ends the script in C++ AND GML.

Exit was incorporated into GML because there was no way to return void; "return;" is valid in a C function returning void but invalid in all cases in GML. exit; is the equivalent to return 0;.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Pages: [1]
  Print