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

Username:   Password: 
 RegisterRegister   
 Walking "Algorithm"
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TheOneTrueGod




PostPosted: Wed Apr 12, 2006 7:17 pm   Post subject: Walking "Algorithm"

a/d moves, just a simple walking thingy I put together. It looks kinda cool if you have music in the background.

code:

var counter : int := 0

var x, y : int := 100

var keys : array char of boolean

View.Set ('offscreenonly')

loop
    Input.KeyDown (keys)
    if keys ('d') then
        x += 1
        counter -= 10
    elsif keys ('a') then
        x -= 1
        counter += 10
    end if
    %counter -= 10
    counter mod= 360
    %Bottom Legs
    drawline (x + round (cosd (counter) * 5), y + 5, x + round (cosd (counter) * 10), max (y + round (sind (counter) * 15) - 10, y - 10), black)
    drawline (x + round (cosd (counter + 180) * 5), y + 5, x + round (cosd (counter + 180) * 10), max (y + round (sind (counter + 180) * 15) - 10, y - 10), black)
    %Middle Legs
    drawline (x + round (cosd (counter)), y + 10, x + round (cosd (counter) * 5), y + 5, black)
    drawline (x + round (cosd (counter)), y + 10, x + round (cosd (counter + 180) * 5), y + 5, black)
    %Torso
    drawline (x + round (cosd (counter)), y + 10, x + round (cosd (counter) * 2), y + 30, black)
    %Top Arm
    drawline (x + round (cosd (counter)), y + 25, x + round (cosd (counter + 10) * 8), y + 20 + round (sind (counter) * 2), black)
    drawline (x + round (cosd (counter)), y + 25, x + round (cosd (counter - 150) * 8), y + 20 + round (sind (counter + 180) * 2), black)
    %Bottom Arm
    drawline (x + round (cosd (counter) * 10) + 8, y + 20 + round (sind (counter) * 5), x + round (cosd (counter + 10) * 8), y + 20 + round (sind (counter) * 2), black)
    drawline (x + round (cosd (counter + 180) * 10) + 8, y + 20 + round (sind (counter + 180) * 5), x + round (cosd (counter - 150) * 8), y + 20 + round (sind (counter + 180) * 2), black)
    %Head
    drawoval (x + round (cosd (counter) * 2), y + 30 + 8, 8, 8, black)

    View.Update
    Time.DelaySinceLast (30)
    cls
end loop
Sponsor
Sponsor
Sponsor
sponsor
ZeroPaladn




PostPosted: Thu Apr 13, 2006 9:20 am   Post subject: (No subject)

very neat.

+10 bits
MiX-MaztA-M8riX




PostPosted: Thu Apr 13, 2006 9:55 am   Post subject: (No subject)

Heh, damn, pretty nice Razz
NikG




PostPosted: Thu Apr 13, 2006 11:26 am   Post subject: (No subject)

Very cool TheOneTrueGod.

Next step might be more movement control (i.e. punch, kick, jump) and you've got the beginning of a stick fighter.

+10 bits

Edit: It IS cooler with music. haha
blaster009




PostPosted: Mon Apr 17, 2006 2:35 pm   Post subject: (No subject)

Lol, love it.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: