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

Username:   Password: 
 RegisterRegister   
 Placing pictures one after another (RPG Character)
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
strike_hawk89




PostPosted: Tue May 10, 2005 8:30 pm   Post subject: Placing pictures one after another (RPG Character)

i cannot get two pics to repeat one after the other. I tried alot of stuff too. I want it so that it shows two steps: character's left foot sticking out, and then characters right foot sticking out, and it keeps on repeating until the user lets go of the movement key (eg KEY_DOWN, etc.) Everytime i have tried the character walks very slow or doesnt show the two pics smoothly when walking across the screen.
code:
setscreen ("graphics:800;500")
setscreen ("graphics:vga")
var x, y : int
var pic1, pic2, pic3, pic4, pic5, pic6, pic7, pic8, pic9 : int
pic1 := Pic.FileNew ("up1.bmp")
pic2 := Pic.FileNew ("up2.bmp")
pic3 := Pic.FileNew ("right1.bmp")
pic4 := Pic.FileNew ("right2.bmp")
pic5 := Pic.FileNew ("left1.bmp")
pic6 := Pic.FileNew ("left2.bmp")
pic7 := Pic.FileNew ("down1.bmp")
pic8 := Pic.FileNew ("down2.bmp")
pic9 := Pic.FileNew ("centerface.bmp")
x := 250
y := 250
var chars : array char of boolean
loop
    Input.KeyDown (chars)
    Pic.Draw (pic9, x, y, picMerge)
    if chars (KEY_UP_ARROW) then
        y := y + 2
        cls
        Pic.Draw (pic1, x, y, picMerge)
    end if
    if chars (KEY_RIGHT_ARROW) then
        x := x + 2
        cls
        Pic.Draw (pic3, x, y, picMerge)
    end if
    if chars (KEY_LEFT_ARROW) then
        x := x - 2
        cls
        Pic.Draw (pic5, x, y, picMerge)
    end if
    if chars (KEY_DOWN_ARROW) then
        y := y - 2
        cls
        Pic.Draw (pic7, x, y, picMerge)
    end if
    delay (10)
    cls
end loop

plz help
Sponsor
Sponsor
Sponsor
sponsor
AsianSensation




PostPosted: Tue May 10, 2005 8:41 pm   Post subject: (No subject)

This is a question best answered with View.Update.

Assuming you have one of the newer version of turing, which would be 4.0.1 or above I believe, then you can use View.Update to fix your flickering and speed problems.

There should also be a tutorial in our tutorial section, detailing how to use View.Update.
strike_hawk89




PostPosted: Tue May 10, 2005 9:08 pm   Post subject: (No subject)

ya that works a bit but not really good... and i want to have another pic so that first it has left leg sticking out and then, like after half a second, the pic changes so that the right leg is sticking out, and it repeats over and over until the user lets go of the button. so i would insert pic2 := Pic.FileNew ("up2.bmp") inside the if statements? (PS. tried that several times but didnt work)
c0bra54




PostPosted: Tue May 10, 2005 10:34 pm   Post subject: (No subject)

blah i seem to be missing the del button on this post.. quick hacker dan.. kill meeeee
c0bra54




PostPosted: Tue May 10, 2005 10:39 pm   Post subject: (No subject)

ummm strike, what you are wanting is more of an animation loop.. and i believe that the easiest way to do this is using an array for each direction

if u don't know what an array is by chance, then check out the tutorial section, i am sure hacker D has a good one in htere somewhere

yeh for make a array to store each pic ofr up down left and right

var down :array 1..2 of int
var up :array 1..2 of int

and then use for loops to do the file new commands
again check forums if not sure on some of this stuff

for i :1..2
down(i) :+ Pic.FileNew ("down" + intstr(i) +".JPG")
up(i) :+ Pic.FileNew ("up" + intstr(i) +".JPG")
end loop

nwo that you have the picture files loaded you can use a count to swithc them on and off
var countup :int :=1
var countdown:int :=1
note some of this is written in pseudocode and algorithm

loop

if keypress check returns up arrow then
if countup =2 then
countup :=1
else
countup:=2
end if
Pic.Draw (up(countup),x,y,picMerge)

elsif keypress returns down arrow then
if countdown =2 then
countdown :=1
else
countdown:=2
end if
Pic.Draw(down(countdown),x,y,picMerge)
end if
end loop

this will make your animation still flash, since you need to sue offscreenonly but this will work for you as of right now.. just substitue in your code, or something and it should work fine.. this is i guess the smarter way of doing it, since you cut down alot of var statements.

enjoy



end loop
MysticVegeta




PostPosted: Wed May 11, 2005 6:20 am   Post subject: (No subject)

There is a tutorial in the Tutorial section that describes how you can import .gif files into turing. .gif is an animation file and can be made usng photoshop, paintshop, etc
c0bra54




PostPosted: Wed May 11, 2005 7:29 am   Post subject: (No subject)

umm turing does not actually import gif's.. it can't use them, you simply use photoshop or anyn other gif spliter, and seperate the gif into jpg's/bmp's...

so yeh, you can't use true animated gif's in turing since they were dumb and never got the licensing for it...
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: