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

Username:   Password: 
 RegisterRegister   
 How do I move pics and change the pic at the same time?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DanceMacabre




PostPosted: Mon Apr 17, 2006 2:20 pm   Post subject: How do I move pics and change the pic at the same time?

I got a sprite sheet of riku from kingdom hearts and I want to know how I can go about making him run in one of 8 directions. How do I do that?
Sponsor
Sponsor
Sponsor
sponsor
TokenHerbz




PostPosted: Mon Apr 17, 2006 3:29 pm   Post subject: (No subject)

i dont use sprites myself... What i do is have some pics for each motion, then use a counter and draw them where they apply...

if moving right draw right1, then right 2, back to 1, and again to 2, when you stop moving right, draw right3 (which will hole the stationary image)...

do this for 4 directions, which is what i do, of a total of 9 pics: Long and crappy work, but i was bored enough to do it, though im sure theres an easier way using the Pic. commands to flip them, etc:
Delos




PostPosted: Mon Apr 17, 2006 4:19 pm   Post subject: (No subject)

TokenHerbz...what do think sprites essentially are!? Laughing Sorry to break it to you, but you have the makings of sprites right there.
Essentially what you'll need to do is to take the sprite sheet and divide it up into seperate pictures - then perform Token's idea upon them. This division could be done either before hand and have each pic saved seperately; or directly from the sprite sheet each time the proggie runs. I'd suggest the former, since it makes your life easier, and doesn't detract from functionality.
DanceMacabre




PostPosted: Mon Apr 17, 2006 4:36 pm   Post subject: (No subject)

what would the code look like for that? sorry, Ive only taken one semester with turing Embarassed
TokenHerbz




PostPosted: Mon Apr 17, 2006 4:50 pm   Post subject: (No subject)

Oh delos, i was thinking sprites where like "dan sprites" which was different..

code can LOOK LIKE this **not this isn't the actuall stuff**

code:


if keys (RIGHT_ARROW_KEY) then
    %%we have a boolean which switch's back and forth to simulate movement
    if draw_start = true then
        %%we draw pic 1
        %%set bool to false
    end if
    %%we need to move the guy too
     manx += manvx
elsif %%left keys / up / down , we do same

else  %%i use this to draw still image's, position facing the direction

    %%simplist code to use for this is
    if dir_right = true then
        %%draw stand_right pic
    elsif dir_left = true then    %%etc
    end if
end if

%%Note, to get dir, simplist way is when you go right, set right := true / others false,   does this help at all???  if you want i can show you my code for my rpg.   But learning threw doing it is better then reading it, (i find anyways)
Cervantes




PostPosted: Mon Apr 17, 2006 5:31 pm   Post subject: (No subject)

TokenHerbz wrote:
Oh delos, i was thinking sprites where like "dan sprites" which was different..

Turing's built-in Sprites (that most people don't have access to), DanSprites, BacchusSprites, I think we had another one... They're all based on the same principle.
Delos




PostPosted: Mon Apr 17, 2006 6:03 pm   Post subject: (No subject)

Where is Bacchus these days? Still around or did he leave a while back?
DanceMacabre




PostPosted: Mon Apr 17, 2006 6:44 pm   Post subject: (No subject)

Many thanks. This is a great help.
Sponsor
Sponsor
Sponsor
sponsor
DanceMacabre




PostPosted: Mon Apr 17, 2006 7:06 pm   Post subject: (No subject)

WAIT!!!!! I'm completely lost with this true/false stuff. Also what kind of variables I'm Using. I'll take that RPG code Laughing
please...
Clayton




PostPosted: Mon Apr 17, 2006 7:22 pm   Post subject: (No subject)

okay, first take a look through the Turing Walkthrough, i will help you immensly if you are new to programming, if you have any questions after post them

p.s. why did you name urself after a death march?
DanceMacabre




PostPosted: Mon Apr 17, 2006 7:40 pm   Post subject: (No subject)

LOL...I named myself DanceMacabre after a weapon in final fantasy 10. Wink
Albrecd




PostPosted: Tue Apr 18, 2006 11:52 am   Post subject: (No subject)

A more efficient way to determine which picture to draw than true and false would be mod. For example:

code:
var num := 0
loop
    num := (num + 1) mod 5
    put num
end loop


Will display the numbers 1 to 5 and then repeat from one.
The range of numbers can easily be modified by changing mod 5 to mod something else.[/code]
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  [ 12 Posts ]
Jump to:   


Style:  
Search: