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

Username:   Password: 
 RegisterRegister   
 Pictures
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
yusong




PostPosted: Fri Jan 11, 2008 3:25 pm   Post subject: Pictures

I am making a game and there is one part where depending on the element that the player picks, a different coloured orb is drawn.

So it would be like this if your element was Fire
Pic.Draw (FireOrb, CharX, CharY, picCopy)

But what if the element was say, water, but i dont want to do
Pic.Draw (WaterOrb, CharX, CharY, picCopy)

Is there a way to do something like this?
Pic.Draw (Element + Orb, CharX, CharY, picCopy)
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Jan 11, 2008 4:00 pm   Post subject: RE:Pictures

not quite in this way. That's a variable pointing to the picture, so instead of just
code:

fireOrb := Pic.New()
waterOrb := Pic.New()

you should also have something like
code:

elementOrb := fireOrb

and then you can always Pic.Draw(elementOrb), and later change what that particular element variable points to.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
yusong




PostPosted: Fri Jan 11, 2008 5:02 pm   Post subject: RE:Pictures

kk, thank you for the help.
yusong




PostPosted: Fri Jan 11, 2008 5:06 pm   Post subject: RE:Pictures

Also, I would like this orb to move to the point I click on the map, how would I do that?
Sean




PostPosted: Fri Jan 11, 2008 5:08 pm   Post subject: Re: Pictures

Are you saying, redraw the picture there?
Tony




PostPosted: Fri Jan 11, 2008 5:12 pm   Post subject: RE:Pictures

Quote:

Pic.Draw (Element + Orb, CharX, CharY, picCopy)

set your CharX and CharY to the location of the mouse. You can get the coordinates of the latter with Mouse.Where()
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
shakin cookie




PostPosted: Fri Jan 11, 2008 5:13 pm   Post subject: RE:Pictures

also, you could PicMerge the element colour and the orb, or use turing's new picBlend

Pic.DrawSpecial(200,100,picCopy,picBlend,100)
Sean




PostPosted: Fri Jan 11, 2008 5:17 pm   Post subject: Re: Pictures

Yes, use mouse_x, mouse_y then if button is pressed, clear screen and redraw orb where mouse_x is.
Sponsor
Sponsor
Sponsor
sponsor
yusong




PostPosted: Fri Jan 11, 2008 5:29 pm   Post subject: RE:Pictures

No, I mean moving it across the screen, as in like a magic spell moving across the screen.
Sry for the confusion.
Tony




PostPosted: Fri Jan 11, 2008 5:48 pm   Post subject: RE:Pictures

use a for-loop
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
yusong




PostPosted: Fri Jan 11, 2008 5:49 pm   Post subject: RE:Pictures

What do you mean?
Nick




PostPosted: Fri Jan 11, 2008 6:53 pm   Post subject: RE:Pictures

for x:orbx.. mousex
orbx:=mousex
end for

Tony wouldn't it be better to rather increase the orb x and y each run through the main loop to make it look cleaner?
yusong




PostPosted: Fri Jan 11, 2008 7:38 pm   Post subject: RE:Pictures

So... How do i do say, from one point to another, that is not on a line or diagonal?
Nick




PostPosted: Fri Jan 11, 2008 7:41 pm   Post subject: RE:Pictures

hmmm I'll see if I can find some old code that you can learn from

EDIT:

found some

Turing:
process moveGuy1
    if chara (1) = true then
        anox := x%this is old code I'm sorry for the
        anoy := y%poor structure and x and y are mouse location
        loop     %also you probably don't want a process sso try to switch into a procedure
            if anox > movex then
                movex := movex + 1
            elsif anox < movex then
                movex := movex - 1
            end if
            if anoy > movey then
                movey := movey + 1
            elsif anoy < movey then
                movey := movey - 1
            end if
            exit when movex = anox and movey = anoy
            %delay (2)
        end loop
    end if
    onlyOnce := false
end moveGuy1


also please note I no longer write like this and cannot believe I ever had :S
yusong




PostPosted: Fri Jan 11, 2008 8:13 pm   Post subject: RE:Pictures

kk, THX
but, it is a 2D Tile game, so, whenever I click, it just stops and the pic does not show.
how do i stop that?
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 2  [ 28 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: