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

Username:   Password: 
 RegisterRegister   
 Character walking effect for side-scroller
Index -> Programming, Turing -> Turing Help
Goto page 1, 2, 3  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
adam_abm




PostPosted: Thu Jun 05, 2003 10:42 pm   Post subject: Character walking effect for side-scroller

hey
i'm making a side scroller and wondered if anybody could help me out on how to alternate the pics to give a walking effect while using the Input.Keydown method of character control.

thanks for the help
Sponsor
Sponsor
Sponsor
sponsor
Martin




PostPosted: Thu Jun 05, 2003 11:00 pm   Post subject: (No subject)

Here it is, you can simplify them with arrays if you want.

code:
var pic1 := Pic.FileNew ("step1.bmp")
var pic2 := Pic.FileNew ("step2.bmp")
var pic3 := Pic.FileNew ("step3.bmp")
var pic4 := Pic.FileNew ("step4.bmp")

var x : int := 50
var step := 1 %What step the player is at
var ch : string(1)
loop
    getch(ch)
    if ch = KEY_RIGHT_ARROW then
        if step = 1 then
            Pic.Draw (pic1, x, 100, picCopy)
         elsif step = 2 then
            Pic.Draw (pic2, x, 100, picCopy)
         elsif step = 3 then
            Pic.Draw (pic3, x, 100, picCopy)
         elsif step = 4 then
            Pic.Draw (pic4, x, 100, picCopy)
         end if
         step := step + 1
         x := x + 10
         if step = 5 then
             step := 1
         end if
    end if
end loop
adam_abm




PostPosted: Fri Jun 06, 2003 10:29 pm   Post subject: (No subject)

Thanks for the code but i'm using the Input.KeyDown command and if i use your way the guy just contantly flashes through the steps (because theres no getch) I know theres a way to do it using the Input.KeyDown command so post if you got time and know the way.

thanks
Mephi




PostPosted: Fri Jun 06, 2003 10:47 pm   Post subject: (No subject)

just building on the other code:
code:
var pic1 := Pic.FileNew ("step1.bmp")
var pic2 := Pic.FileNew ("step2.bmp")
var pic3 := Pic.FileNew ("step3.bmp")
var pic4 := Pic.FileNew ("step4.bmp")

var x : int := 50
var step := 1 %What step the player is at
var ch : array char of boolean
loop
    Input.KeyDown (ch)
    if ch (KEY_RIGHT_ARROW) then
        if step = 1 then
            Pic.Draw (pic1, x, 100, picCopy)
         elsif step = 2 then
            Pic.Draw (pic2, x, 100, picCopy)
         elsif step = 3 then
            Pic.Draw (pic3, x, 100, picCopy)
         elsif step = 4 then
            Pic.Draw (pic4, x, 100, picCopy)
         end if
         step := step + 1
         x := x + 10
         if step = 5 then
             step := 1
         end if
    end if
end loop


basically the same thing, just change to input.keydown
JayLo




PostPosted: Tue Jun 17, 2003 5:48 pm   Post subject: (No subject)

oh man. lol according to the turing manual, GIFs should be in Turing, which would render most of this useless.
Andy




PostPosted: Tue Jun 17, 2003 6:06 pm   Post subject: (No subject)

according to the turing manual, sprites work and its the best language and that tom west is a genius
JayLo




PostPosted: Tue Jun 17, 2003 6:06 pm   Post subject: (No subject)

according to the turing manual, it's a party!
Andy




PostPosted: Tue Jun 17, 2003 6:06 pm   Post subject: (No subject)

but ya if GIF works in turing, i'd be awsome cause then you can import animated pics
Sponsor
Sponsor
Sponsor
sponsor
JayLo




PostPosted: Tue Jun 17, 2003 6:08 pm   Post subject: (No subject)

well. tom west SAYS june 2003, but it's prolly not likely.
Andy




PostPosted: Tue Jun 17, 2003 6:12 pm   Post subject: (No subject)

tom west is a big fag, lazy bum
JayLo




PostPosted: Tue Jun 17, 2003 6:35 pm   Post subject: (No subject)

agreed, but 'beggars can't be choosers'.
Andy




PostPosted: Wed Jun 18, 2003 10:33 am   Post subject: (No subject)

lol true, if you complain to him about how crap turing is he doesn't reply, but if you report a bug he replys right away asking how he can recreate the bug
PaddyLong




PostPosted: Wed Jun 18, 2003 11:57 am   Post subject: (No subject)

probably because it is more important to make what you have now working entirely than making turing better as a whole as you seem so bent on doing... really turing isn't meant to make retail programs or anything, just for learning. if you want a better language, learn something like C++ or Java. but please stop whining about how bad turing is or whatever it is you think is wrong with it. it does what it was created to do just fine.
JayLo




PostPosted: Wed Jun 18, 2003 1:25 pm   Post subject: (No subject)

i guess. okay paddy. challenge accepted.
Andy




PostPosted: Wed Jun 18, 2003 3:06 pm   Post subject: (No subject)

wha? what challange? what's going on? is it me or is anyone else confused?
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 3  [ 31 Posts ]
Goto page 1, 2, 3  Next
Jump to:   


Style:  
Search: