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

Username:   Password: 
 RegisterRegister   
 Person waving problem!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Ghostblade




PostPosted: Mon May 13, 2013 12:19 pm   Post subject: Person waving problem!!

What is it you are trying to achieve?
a person waving

What is the problem you are having?
my persons arm isnt erasing

Describe what you have tried to solve this problem
tried adding cls or offscreenonly


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)



Turing:


setscreen ("graphics:max;max")


%Hand Wave Variables
var handwavex : int := maxx - 570
var handwavey : int := 265
var handwave : int := 5

loop

    %Person
    drawfillbox (maxx - 500, 100, maxx - 550, 225, 2) %Top
    drawfilloval (maxx - 525, 225, 50, 50, 90) %Head
    Draw.ThickLine (maxx - 500, 170, maxx - 485, 125, 5, 7) %Left Arm
    drawfilloval (maxx - 545, 225, 5, 5, 7) %Left Eye
    drawfilloval (maxx - 505, 225, 5, 5, 7) %Right Eye
    drawarc (maxx - 525, 205, 5, 5, 180, 360, 7) %Smile
    drawarc (maxx - 520, 210, 5, 5, 180, 360, 7)
    drawarc (maxx - 530, 210, 5, 5, 180, 360, 7)
    Draw.ThickLine (maxx - 500, 100, maxx - 490, 50, 5, 7) %Left Leg
    Draw.ThickLine (maxx - 550, 100, maxx - 560, 50, 5, 7) %Right Leg
    delay (100)
    %Waving Arm
    Draw.ThickLine (maxx - 550, 170, handwavex, handwavey, 5, 7)
    handwavex := handwavex - handwave
   
    handwavey := handwavey - handwave
    if handwavex < maxx - 600 then
        handwave := -handwave
       cls
  elsif handwavex > maxx - 560 then
        handwave := -handwave
       cls
View.Update
    end if
       
end loop




Please specify what version of Turing you are using
latest version
Sponsor
Sponsor
Sponsor
sponsor
Ghostblade




PostPosted: Mon May 13, 2013 12:21 pm   Post subject: RE:Person waving problem!!

also, when i try to add it in my main program, it disappears Sad?
Nathan4102




PostPosted: Mon May 13, 2013 12:46 pm   Post subject: RE:Person waving problem!!

All your cls's and View.Updates are in if statements. Try moving them outside of the if statement, then see what happens.
Ghostblade




PostPosted: Tue May 14, 2013 1:04 pm   Post subject: RE:Person waving problem!!

it still wont work, his hand seems to to copy itself and it looks like he had 8 hands before it erases.
Ghostblade




PostPosted: Tue May 14, 2013 1:07 pm   Post subject: RE:Person waving problem!!

fixed it thanks! added a cls at the very beginning
Ghostblade




PostPosted: Tue May 14, 2013 1:58 pm   Post subject: RE:Person waving problem!!

%############Loading Screen#############%
var loadPercent : int := 0
var loadingMessage : string := ""


proc load1 ()
loadingMessage := "Loading Screen"
delay (10)
loadPercent += 10
end load1

proc load2 ()
loadingMessage := "Loading Objects"
delay (15)
loadPercent += 15
end load2

proc load3 ()
loadingMessage := "Loading Animations"
delay (20)
loadPercent += 50
end load3

proc load4 ()
loadingMessage := "Loading Pure Awesomeness"
delay (25)
loadPercent += 25
end load4


process loadGameProcess ()
load1 ()
load2 ()
load3 ()
load4 ()
loadingMessage := "DONE"
end loadGameProcess


proc loadGame ()
fork loadGameProcess

% Display Loading Bar
var loadingPercentFont : int := Font.New ("sans serif:16:bold")
var loadingMessageFont : int := Font.New ("sans serif:24:bold")

loop
View.Update ()
Time.DelaySinceLast (100)
Draw.Cls

Font.Draw ( loadingMessage, 30, maxy div 2 + 40, loadingMessageFont, black )

% The actual bar and the percentage listed for it
Draw.FillBox (0, maxy div 2 + 15, maxx, maxy div 2 + 20, black )
Draw.FillBox (0, maxy div 2 - 15, maxx, maxy div 2 - 20, black )
Draw.FillBox (0, maxy div 2 - 15, round (maxx / 100 * loadPercent), maxy div 2 + 15, darkgrey)
Font.Draw ( intstr(loadPercent)+"%", maxx div 2 - 8, maxy div 2 - 8, loadingPercentFont, brightred )

exit when loadPercent >= 100
end loop


end loadGame


loadGame


%####SETSCREEN###%
setscreen("graphics:max;max")

drawfillbox (0,0,maxx,maxy,10)
%#######BOAT MOVING + BACKGROUND#######%
var posy1 :int:=200
var posx2 : int:= 400
var motorboat : int := Pic.FileNew ("motor boat.bmp")
var handwavex : int := maxx - 270
var handwavey : int := 265
var handwave : int := 5

process boat
loop

Pic.Draw (motorboat,posx2,posy1,picMerge)
posx2 := posx2-1

delay (100)
end loop
end boat

View.Update

%Hand Wave Variables


process person
loop
%Person
drawfillbox (maxx - 200, 100, maxx - 250, 225, 2) %Top
drawfilloval (maxx - 225, 225, 50, 50, 90) %Head
Draw.ThickLine (maxx - 200, 170, maxx - 185, 125, 5, 7) %Left Arm
drawfilloval (maxx - 245, 225, 5, 5, 7) %Left Eye
drawfilloval (maxx - 205, 225, 5, 5, 7) %Right Eye
drawarc (maxx - 225, 205, 5, 5, 180, 360, 7) %Smile
drawarc (maxx - 220, 210, 5, 5, 180, 360, 7)
drawarc (maxx - 230, 210, 5, 5, 180, 360, 7)
Draw.ThickLine (maxx - 200, 100, maxx - 190, 50, 5, 7) %Left Leg
Draw.ThickLine (maxx - 250, 100, maxx - 260, 50, 5, 7) %Right Leg

delay (100)

%Waving Arm

Draw.ThickLine (maxx - 250, 170, handwavex, handwavey, 5, 7)

handwavex := handwavex - handwave

handwavey := handwavey - handwave

if handwavex < maxx - 300 then
handwave := -handwave

elsif handwavex > maxx - 260 then
handwave := -handwave

end if


end loop
end person
fork person
fork boat


CAN SOMEONE PLEASE FIX THIS!!! when i add them together i cant cls or it wont work so they have streaks and i dont know how to get rid of em!!
Nathan4102




PostPosted: Tue May 14, 2013 2:24 pm   Post subject: RE:Person waving problem!!

Thats a really bad way to do animations. Unless you're required to use processes, like maybe a class assignment, try this:
Turing:

Procedure Person
....
end Person

Procedure Boat
....
end Boat

loop
    Person
    Boat
    View.Update
    cls
    delay(100)
end loop
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  [ 7 Posts ]
Jump to:   


Style:  
Search: