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

Username:   Password: 
 RegisterRegister   
 MY FIRST PROGRAM
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ZeroPaladn




PostPosted: Thu Jun 09, 2005 9:29 am   Post subject: MY FIRST PROGRAM

this is my first ever program that I made, by myself. I know its just compared to everything else on this site but i hope you guys can give me kudos just for doing htis.
Sponsor
Sponsor
Sponsor
sponsor
Aziz




PostPosted: Thu Jun 09, 2005 12:40 pm   Post subject: (No subject)

That's pretty good, especially for a first program. But, you don't need an Input.hasch (btw, you can just call hasch instead of Input.hasch), Input.KeyDown works by itself (it probably uses hasch itself). And you can change

code:
y := y + 10


to

code:
y += 10


or even better,

code:
y += 1


which is smoother

+= is incremental

-= is decremental

And, if you make each separate key press check a different if statment, you can get diagonal movement Smile Here's the code I changed around a bit. Pretty sweet, though. My first program was a simple art picture. And then a "Hi, my name is" Razz

code:
setscreen ("graphics:640,480,offscreenonly")

var x : int := 300
var y : int := 200
var chars : array char of boolean

loop
    cls
    drawfilloval (x, y, 20, 20, 43)
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        y += 1
    end if
    if chars (KEY_DOWN_ARROW) then
        y -= 1
    end if
    if chars (KEY_LEFT_ARROW) then
        x -= 1
    end if
    if chars (KEY_RIGHT_ARROW) then
        x += 1
    end if
    View.Update
end loop
ZeroPaladn




PostPosted: Thu Jun 09, 2005 12:43 pm   Post subject: (No subject)

thanks guy, er girl, whatever. ive allways had trouble with truing, i could never get it right. thanks for cleaning my code for me.

EDIT
i have also had trouble with spelling Smile this program is the beta for my rocket game. expect it sometime at the end of the month.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: