title: dynamic teleport using gml
body: <p>I am making a version of asteroids and I was trying to create a system where you can teleport a specific amount of pixels into whatever direction you are facing. Every time I tried, the image would teleport to the same spot in the map. I scrapped the idea and moved on, but I remembered this site and decided that if anybody would know, it would be you guys.</p>
  
  <p>I started with this concept:</p>
  
  <p>//maybe jump to position//</p>
  
  <pre><code>x = xstart;
  y = ystart;
  </code></pre>
  
  <p>but because of needing the position to be dynamic, I thought to try to implement this concept:</p>
  
  <pre><code>laser = instance_create(x + lengthdir_x(LenXL, image_angle) - lengthdir_y(LenYL, image_angle), y + lengthdir_y(LenXL, image_angle) +lengthdir_x(LenYL, image_angle),obj_laser);  
  laser.direction = image_angle;
  laser.image_angle = laser.direction;
  </code></pre>
  
  <p>this one is about shooting from a specific point on your image no matter where or what direction, so I tough I could do a jump based on a specific number of pixels from the front of the ship.</p>
  
  <pre><code>sprite_index = spr_teleport;
  teleport = instance_create(x + lengthdir_x(TeleX, image_angle) - lengthdir_y(TeleY, image_angle), y + lengthdir_y(TeleX, image_angle) +lengthdir_x(TeleY, image_angle),obj_player);  
  teleport.direction = image_angle;
  teleport.image_angle = teleport.direction;
  </code></pre>
  
  <p>can somebody tell me what I am doing wrong and how I can fix this?</p>