# ENIGMA Development Environment

 Pages: [1]
RetroX
 Posted on: August 09, 2008, 10:18:53 AM

Master of all things Linux

Location: US
Joined: Apr 2008
Posts: 1055

Here's how you can recreate it, since it isn't done yet:
Code: [Select]
`// Syntax: motion_add(direction,speed)// Adds a set motion to the current motion// Calculate where the object would travel at the different speedsx1=cos(degtorad(direction))*speed;y1=-sin(degtorad(direction))*speed;x2=cos(degtorad(argument0))*argument1;y2=-sin(degtorad(argument0))*argument1;// Add up the two coordinatesx3=x1+x2;y3=y1+y2;// Set the new speed to the distance to the new coordinatesspeed=point_distance(0,0,x3,y3);// Find out what direction the new coordinates are from our positiondirection=point_direction(0,0,x3,y3);`
I believe that should work.
 « Last Edit: August 09, 2008, 10:20:31 AM by RetroX » 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?
TGMG
 Reply #1 Posted on: August 09, 2008, 02:36:42 PM

Joined: Jun 2008
Posts: 107

Doesn't this work?:
direction+argument0
speed+argument1
 Logged
me
GMbed 2.0 :: Embed you gm games in websites.
RetroX
 Reply #2 Posted on: August 09, 2008, 02:51:01 PM

Master of all things Linux

Location: US
Joined: Apr 2008
Posts: 1055

No, motion_add adds a new motion to the existing one.  To put it this way, let's say we have a block moving at a speed of 2 and in direction 0 (right).  If we add a motion of 1 in direction 180 (left) then the block will continue moving in the same direction, only with a speed of 1.  If we add that same motion again, the block will come to a complete halt.

That is what motion_add() is for.
 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?
TGMG
 Reply #3 Posted on: August 09, 2008, 04:02:38 PM

Joined: Jun 2008
Posts: 107

Thanks RetroX, never actually used that function but i see now it could be quite useful
 Logged
me
GMbed 2.0 :: Embed you gm games in websites.
serprex
 Reply #4 Posted on: August 17, 2008, 03:52:05 PM
Smooth ER

Joined: Apr 2008
Posts: 106

Couldn't you just add x2 and y2 to x1 and y1?
 Logged
RetroX
 Reply #5 Posted on: September 05, 2008, 06:13:18 PM

Master of all things Linux

Location: US
Joined: Apr 2008
Posts: 1055

I assemble code.  I don't "save space" like you do.
 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?
Josh @ Dreamland
 Reply #6 Posted on: November 16, 2008, 04:35:50 PM

Prince of all Goldfish

Location: Ohio, United States
Joined: Feb 2008
Posts: 2925

No, assemblers assemble code. You just write it.
 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]