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

Username:   Password: 
 RegisterRegister   
 RPG Problem
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Smarteez




PostPosted: Thu Dec 07, 2006 7:27 pm   Post subject: RPG Problem

Hey guys... I am now making an RPG game and have a problem... I was just doin at test run to see how it would turn out and decided to make my guy move... As I put in the code to get him to move... My finger goes to the 'F1' button...It pushes it... and then Turing says "Variable has no value." Although the window pops up with my graphics but my guy cant move... please help...
code:
setscreen ("graphics : 800;600")
setscreen ("nocursor")
var chars : array char of boolean
var lvl1_1 : int
lvl1_1 := Pic.FileNew ("Pictures/Level 2/grass.jpg")
Pic.Draw (lvl1_1, 0, 0, picCopy)
Pic.Draw (lvl1_1, 350, 0, picCopy)
Pic.Draw (lvl1_1, 700, 0, picCopy)
var icastillx, icastilly : int
icastillx := 5
icastilly := 93
var icastill : int
icastill := Pic.FileNew ("Pictures/Movements/Icabobstill.jpg")
Pic.Draw (icastill, icastillx, icastilly, picCopy)
Pic.Free (icastill)
var sky : int
sky := Pic.FileNew ("Pictures/Level 2/bluesky.jpg")
Pic.Draw (sky, 0, 180, picCopy)
Pic.Draw (sky, 775, 180, picCopy)
procedure getKey
    var ch : string (1)
    getch (ch)
end getKey
loop
    % Here is where the error is.
if chars (KEY_UP_ARROW) then
        icastilly := icastilly + 1
        Pic.Draw (icastill, icastillx, icastilly, picCopy)
    elsif chars (KEY_DOWN_ARROW) then
        icastilly := icastilly - 1
        Pic.Draw (icastill, icastillx, icastilly, picCopy)
    elsif chars (KEY_LEFT_ARROW) then
        icastillx := icastillx - 1
        Pic.Draw (icastill, icastillx, icastilly, picCopy)
    elsif chars (KEY_RIGHT_ARROW) then
        icastillx := icastillx + 1
    end if
end loop
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Thu Dec 07, 2006 9:53 pm   Post subject: (No subject)

You have no Input.KeyDown in there to give chars a chance to get a value, really, look over your code again before posting problems like this. Just posting questions when it is fairly obvious not very much effort has been put in kinda frustrates me.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: