
-----------------------------------
metal Slug 2
Sun Oct 18, 2009 7:40 am

Object Avoidance newbie question
-----------------------------------
What is it you are trying to achieve?
  Hi, I am a first year programmer (ISC3U), so please bear with me.  I've gone a little ahead and started playing with graphics in Turing.  What I have done so far is created a program which (based on the Turing walk-through on this site, Thanks! =) ) creates two circles.  One circle (the red one), you control with the D-pad on your keyboard.  The other ball (the Blue one), moves in the opposite direction you are in, if you are also within an X distance from it.  This will eventually be part of my final project (A Zelda RPG...FTW!)..as some sort of enemy maneuvering.

What is the problem you are having?
I would like to know how I can make the blue ball travel linearly in the opposite direction of the red ball based upon the slope between the red and blue ball.  Essentially, if I am traveling diagonally right and up at the blue ball, I want the blue ball to travel right and up also, away from the ball I'm controlling...or have the ball move away at the same angle in which I am approaching it
I am also having problems with flickering, I cannot figure out how to get it to work...View.Update and "offscreenonly" do not work for me...
Describe what you have tried to solve this problem
 slope2 and distance_between_centres  x2 and y > y2 then
        x2 -= speed3
        y2 -= speed3
    end if

    if slope < slope3 and slope > slope4 and distance_between_centres  x2 and y < y2 then
        x2 -= speed3
        y2 += speed3
    end if

    if slope < slope1 and slope > slope2 and distance_between_centres  slope4 and distance_between_centres  y2 then
        x2 += speed3
        y2 -= speed3
    end if

    % X and Y movements
    if slope < slope2 and slope > slope3 and distance_between_centres  x2 then
        x2 -= speed2
    elsif slope < slope2 and slope > slope3 and distance_between_centres  -340 and slope < 200 and slope not= slope1 and slope not= slope2 and slope not= slope3 and slope not= slope4 and*/ y < y2 and distance_between_centres  -340 and slope < 200 and slope not= slope1 and slope not= slope2 and slope not= slope3 and slope not= slope4 and*/ y > y2 and distance_between_centres  -340 and slope < 200 and slope not= slope1 and slope not= slope2 and slope not= slope3 and slope not= slope4 and y > y2 and distance_between_centres 