Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Moving Amrm Problem
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Bleaych




PostPosted: Sun Jan 18, 2009 6:29 pm   Post subject: Moving Amrm Problem

I am attempting to make my Aliens Arm Move down, and Even though I am re printing the code to stop the asrm from deleting, it is showing a duplicate of the arm, yet oce the moving arm reaches it, it all disapears.

Turing:

var cratearm : int
process movearmdownc
    cratearm := 130
    for decreasing conte : 20 .. 1
        cratearm := cratearm - 1
        Draw.ThickLine (160, cratearm, 280, 130, 30, 49)
        delay (50)
        Draw.ThickLine (160, cratearm, 280, 130, 30, 0)
    end for
end movearmdownc
Draw.ThickLine (160, 110, 280, 130, 30, 49)


%head
drawfilloval (350, 245, 125, 70, 49)
%right eye
drawfilloval (400, 260, 25, 15, 44)
%left eye
drawfilloval (290, 260, 25, 15, 44)
%left eye ring
drawoval (400, 260, 10, 5, 12)
%right eye ring
drawoval (285, 260, 10, 5, 12)
%right eye pupil
drawfilloval (401, 260, 5, 2, 12)
%left eye pupil
drawfilloval (285, 260, 5, 2, 12)
%right ear
drawline (410, 307, 450, 350, 49)
%right ear circle
drawfilloval (450, 350, 20, 10, 49)
%left ear
drawline (300, 307, 250, 350, 49)
%left ear circle
drawfilloval (260, 350, 20, 10, 49)
%mouth
drawfilloval (350, 200, 25, 20, 225)
%tounge
drawline (350, 170, 350, 175, 62)
%body
drawfilloval (350, 105, 100, 70, 49)
%rght arm above
Draw.ThickLine (360, 120, 550, 215, 30, 49)
%right arm below
Draw.ThickLine (370, 130, 520, 130, 30, 49)
%leftarm
Draw.ThickLine (160, 210, 280, 130, 30, 49)

%right wheel
drawfilloval (400, 40, 40, 30, 255)
%right wheel middle
drawfilloval (400, 40, 10, 5, 0)
%left wheel
drawfilloval (290, 40, 40, 30, 255)
%left wheel middle
drawfilloval (290, 40, 10, 5, 0)
%box
drawfillbox (10, 1, 180, 100, 90)
fork movearmdownc
Sponsor
Sponsor
Sponsor
sponsor
Euphoracle




PostPosted: Sun Jan 18, 2009 6:43 pm   Post subject: RE:Moving Amrm Problem

You're drawing the arm before the process starts, which is leaving an artifact, and you're clearing it after you draw the arm. I've commented out the static arm that was being drawn, and rearranged the process by moving the "eraser" to the top, before you modify cratearm. Also, a process is a really bad way of doing this. It can be done in a procedure. Don't use processes unless you have to.

Turing:
var cratearm : int
process movearmdownc
    cratearm := 130
    for decreasing conte : 20 .. 1
    Draw.ThickLine (160, cratearm, 280, 130, 30, 0)
        cratearm := cratearm - 1
        Draw.ThickLine (160, cratearm, 280, 130, 30, 49)
        delay (50)
    end for
end movearmdownc
%Draw.ThickLine (160, 110, 280, 130, 30, 49)


%head
drawfilloval (350, 245, 125, 70, 49)
%right eye
drawfilloval (400, 260, 25, 15, 44)
%left eye
drawfilloval (290, 260, 25, 15, 44)
%left eye ring
drawoval (400, 260, 10, 5, 12)
%right eye ring
drawoval (285, 260, 10, 5, 12)
%right eye pupil
drawfilloval (401, 260, 5, 2, 12)
%left eye pupil
drawfilloval (285, 260, 5, 2, 12)
%right ear
drawline (410, 307, 450, 350, 49)
%right ear circle
drawfilloval (450, 350, 20, 10, 49)
%left ear
drawline (300, 307, 250, 350, 49)
%left ear circle
drawfilloval (260, 350, 20, 10, 49)
%mouth
drawfilloval (350, 200, 25, 20, 225)
%tounge
drawline (350, 170, 350, 175, 62)
%body
drawfilloval (350, 105, 100, 70, 49)
%rght arm above
Draw.ThickLine (360, 120, 550, 215, 30, 49)
%right arm below
Draw.ThickLine (370, 130, 520, 130, 30, 49)
%leftarm
Draw.ThickLine (160, 210, 280, 130, 30, 49)

%right wheel
drawfilloval (400, 40, 40, 30, 255)
%right wheel middle
drawfilloval (400, 40, 10, 5, 0)
%left wheel
drawfilloval (290, 40, 40, 30, 255)
%left wheel middle
drawfilloval (290, 40, 10, 5, 0)
%box
drawfillbox (10, 1, 180, 100, 90)
fork movearmdownc
saltpro15




PostPosted: Sun Jan 18, 2009 10:23 pm   Post subject: RE:Moving Amrm Problem

try to avoid processes in Turing, use procedures instead, far more reliable.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: