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

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




PostPosted: Mon Jan 28, 2013 12:49 pm   Post subject: RE:Gotta Question

Nope, because the number you set is already an integer type, not a real type.

Instead of var integerNumber : int, you want var realNumber : real. Classify it as a real, not an int.
Sponsor
Sponsor
Sponsor
sponsor
Dazzle




PostPosted: Mon Jan 28, 2013 9:10 pm   Post subject: RE:Gotta Question

ohhhhhh.... OMG thank you soo much.. im gunna try it now i hope it works Smile
Dazzle




PostPosted: Mon Jan 28, 2013 9:37 pm   Post subject: Re: Gotta Question

ok so.. i get it but its not working :/ heres the code im working with

code:

loop

    reDraw
    Input.KeyDown (key)
    if key ('a') and tiles (px - 1, py) = 0 then
     var player_movement : real :=0.25
        px -=player_movement Pic.Draw (wizard3 ,px * 32, py * 32,0)
        View.Update
    end if
    if key ('d') and tiles (px + 1, py) = 0 then
        movement Pic.Draw (wizard1 ,px * 32, py * 32,0)
        View.Update
    end if
    if key('s') and tiles (px , py - 1) = 0 then
        movement Pic.Draw (wizard2 ,px * 32, py * 32,0)
        View.Update
        end if
    if key ('w') and tiles (px , py + 1) = 0 then
        movement Pic.Draw (wizard0 ,px * 32, py * 32,0)
        View.Update
    end if 
    delay (50)
end loop


Got any ideas??
Tony




PostPosted: Tue Jan 29, 2013 12:12 am   Post subject: RE:Gotta Question

code:

var player_movement : real :=0.25
        px -=player_movement

That takes care of the first of four steps, but currently you have no way of remembering that those steps began to happen. When should you do the second 0.25?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Dazzle




PostPosted: Tue Jan 29, 2013 12:54 am   Post subject: RE:Gotta Question

after payer_movement..

like this?????

px -=player_movement : real:=0.25
Tony




PostPosted: Tue Jan 29, 2013 3:12 am   Post subject: RE:Gotta Question

I don't understand what you mean.

But unlike many other subjects, the awesome part about CS is that you can actually just try things out and see what the compiler thinks about it!
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Dazzle




PostPosted: Tue Jan 29, 2013 7:46 am   Post subject: RE:Gotta Question

yea.. lol i did try. ;p .. but here ill ask agan how can i move by pixels not tiles?
Insectoid




PostPosted: Tue Jan 29, 2013 2:00 pm   Post subject: RE:Gotta Question

code:
Pic.Draw (wizard1 ,px * 32, py * 32,0)


As long as you're drawing to px*32, py*32, you will not be able to move by pixels.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Jan 29, 2013 3:25 pm   Post subject: RE:Gotta Question

quarter-tile steps are fine -- e.g. round(0.25 * 32). But there needs to be a mechanism to remember to take the other 3 steps during the following game frames.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Dazzle




PostPosted: Tue Jan 29, 2013 5:02 pm   Post subject: RE:Gotta Question

could you possible make a snippet for the mechanisim
Dazzle




PostPosted: Wed Feb 13, 2013 10:24 am   Post subject: RE:Gotta Question

Could you please help ive been w8ing for a while and there has been no answer
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 2 of 2  [ 26 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: