The Onyx Platform
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Turing --Help

2 posters

Go down

Turing --Help Empty Turing --Help

Post  Onyx Wed Mar 19, 2008 4:49 pm

A simple programming language, easy to use, and learn, that I've basically mastered (Java's a bitch anyways Mad ).
Download from here (it's free) if you want it:
http://www.holtsoft.com/

I'll use this as a help thread.
Onyx
Onyx
Administrator
Administrator

Male Number of posts : 403
Registration date : 2007-11-09

G.W. Stats
Gangsta Name: Pimp Slap Sr.
Gang:

https://onyxplatform.forumotion.com

Back to top Go down

Turing --Help Empty Turing Cannonball Game

Post  krisko Wed Mar 19, 2008 5:17 pm

I am creating a game called CannonChuck!!
But... i need a little help on the final stages of production.
Here is the code that i got so far:

View.Set ("graphics:900;400,nobuttonbar") %frame manipulation
var pic : int := Pic.FileNew ("chucknorris3.jpg")
var pic2 : int := Pic.FileNew ("the world trade center.jpg")
var pic3 : int := Pic.FileNew ("wtc1.jpg")
var pic4 : int := Pic.FileNew ("world_trade_centre.jpg")
var font1 : int
var key : string (1)
var velocity, theta : real := 0
var x, y : int := 0
var timer : real := 0
var gravity : real := 1 %GRAVITY
var counter : int := 0

%draws Chuck
Pic.Draw (pic, 0, 0, picMerge)
%World Trade Center
Pic.Draw (pic2, 635, 0, picCopy)
%Title
font1 := Font.New ("Palatino:50:bold,italic")
assert font1 > 0
Font.Draw ("CannonChuck Game", 50, 290, font1, 12)
Font.Free (font1)
locatexy (300, 230)
put "Press any key to continue" ..
getch (key)
cls
%instructions
put ""
put ""
put "Hit the top of the World Trade Center with Chuck Norris to destroy it. Once the World Trade Center has been hit"
put "at the right spot by Chuck Norris, it will explode and sink to the ground. To shoot Chuck Norris, type in low"
put "digit integers for the initial power and angle of deployment."
put ""
put "Press any key to continue" ..
getch (key)
cls
loop
Pic.Draw (pic, 0, 0, picMerge)
%World Trade Center
Pic.Draw (pic2, 635, 0, picCopy)
%angle and power
locatexy (0, 390)
put "Enter an initial power (1 to 30): " ..
get velocity
locatexy (0, 390)
drawfillbox (0, 380, 200, 400, 0)
put "Enter an angle of deployment (0 to 90): " ..
get theta
loop
setscreen ("offscreenonly")
Pic.Draw (pic, x, y, picMerge)
delay (100)
cls
Pic.Draw (pic2, 635, 0, picCopy)
Pic.Draw (pic, x, y, picMerge)
View.Update
x := round (x + velocity * timer * cosd (theta))
y := round (y + velocity * timer * sind (theta) - 0.5 * gravity * timer * timer)
timer := timer + 0.1
View.Update
exit when x >= 900
if x >= 700 and y >= 250 and y <= 350 then
cls
end if
end loop
end loop

i just cannot get the program to rerun and my if statements don't seem to work.
krisko
krisko
Mini Octorok
Mini Octorok

Male Number of posts : 16
Registration date : 2008-03-19

Back to top Go down

Turing --Help Empty Re: Turing --Help

Post  krisko Wed Mar 19, 2008 5:23 pm

woo man, all my stuff is going all over the place an for a second, i couldn't find it. lol!
krisko
krisko
Mini Octorok
Mini Octorok

Male Number of posts : 16
Registration date : 2008-03-19

Back to top Go down

Turing --Help Empty Re: Turing --Help

Post  Onyx Wed Mar 19, 2008 5:32 pm

There. After you used the Setscreen command, you exit the game to restart right? Well you needed to put the View.Update after you askt eh user for your Power/Angle again. I also threw in a CLS when you exit the loop (to clear everything), and I also made it so the x,y, and timer variables reset after entering the loop again. This was the thing screwing you up. You had "exit when x>900. After the first shot, X would still be over 900 unless you make it =0 again.

Code:

View.Set ("graphics:900;400,nobuttonbar") %frame manipulation
var pic : int := Pic.FileNew ("chucknorris3.jpg")
var pic2 : int := Pic.FileNew ("the world trade center.jpg")
var pic3 : int := Pic.FileNew ("wtc1.jpg")
var pic4 : int := Pic.FileNew ("world_trade_centre.jpg")
var font1 : int
var key : string (1)
var velocity, theta : real := 0
var x, y : int := 0
var timer : real := 0
var gravity : real := 1 %GRAVITY
var counter : int := 0

%draws Chuck
Pic.Draw (pic, 0, 0, picMerge)
%World Trade Center
Pic.Draw (pic2, 635, 0, picCopy)
%Title
font1 := Font.New ("Palatino:50:bold,italic")
assert font1 > 0
Font.Draw ("CannonChuck Game", 50, 290, font1, 12)
Font.Free (font1)
locatexy (300, 230)
put "Press any key to continue" ..
getch (key)
cls
%instructions
put ""
put ""
put "Hit the top of the World Trade Center with Chuck Norris to destroy it. Once the World Trade Center has been hit"
put "at the right spot by Chuck Norris, it will explode and sink to the ground. To shoot Chuck Norris, type in low"
put "digit integers for the initial power and angle of deployment."
put ""
put "Press any key to continue" ..
getch (key)
cls
loop
x:=0                                                                          %new code
y:=0                                                                            %new code
timer:=0                                                                        %new code

    Pic.Draw (pic, 0, 0, picMerge)
    %World Trade Center
    Pic.Draw (pic2, 635, 0, picCopy)
    %angle and power
    locatexy (0, 390)
    put "Enter an initial power (1 to 30): " ..
    View.Update                                                                      %new code
    get velocity
    locatexy (0, 390)
    drawfillbox (0, 380, 200, 400, 0)
    put "Enter an angle of deployment (0 to 90): " ..
    View.Update                                                                        %new code
    get theta
    loop
        setscreen ("offscreenonly")
        Pic.Draw (pic, x, y, picMerge)
    delay (100)
        cls
        Pic.Draw (pic2, 635, 0, picCopy)
      Pic.Draw (pic, x, y, picMerge)
        View.Update
        x := round (x + velocity * timer * cosd (theta))
        y := round (y + velocity * timer * sind (theta) - 0.5 * gravity * timer * timer)
        timer := timer + 0.1
        View.Update
        exit when x >= 900
        exit when y<0                                                                %new code
        if x >= 700 and y >= 250 and y <= 350 then
            cls
        end if
    end loop
cls                                                                                        %new code
end loop

woo man, all my stuff is going all over the place an for a second, i couldn't find it.
Yea well you put it in the talk thread, after I made the Turing help thread soo.... Wink
Onyx
Onyx
Administrator
Administrator

Male Number of posts : 403
Registration date : 2007-11-09

G.W. Stats
Gangsta Name: Pimp Slap Sr.
Gang:

https://onyxplatform.forumotion.com

Back to top Go down

Turing --Help Empty Re: Turing --Help

Post  krisko Wed Mar 19, 2008 5:47 pm

It works like a charm now. When i went to post again in yours site, the thread still showed above what i am writing here. I don't know if that is an bug or not in your site. Just so you know. I don't know about the actual physics still because it still seems like it is going straight and not on an arc.
krisko
krisko
Mini Octorok
Mini Octorok

Male Number of posts : 16
Registration date : 2008-03-19

Back to top Go down

Turing --Help Empty Re: Turing --Help

Post  Onyx Wed Mar 19, 2008 5:49 pm

^ nah, that's just so you don't forgot what the last couple people said Wink
Onyx
Onyx
Administrator
Administrator

Male Number of posts : 403
Registration date : 2007-11-09

G.W. Stats
Gangsta Name: Pimp Slap Sr.
Gang:

https://onyxplatform.forumotion.com

Back to top Go down

Turing --Help Empty Re: Turing --Help

Post  krisko Wed Mar 19, 2008 6:12 pm

what the other people said ends up on top of what i am writing in the the reply box
krisko
krisko
Mini Octorok
Mini Octorok

Male Number of posts : 16
Registration date : 2008-03-19

Back to top Go down

Turing --Help Empty Re: Turing --Help

Post  krisko Wed Mar 19, 2008 6:34 pm

Here is the program finished to hand-in standards
Code:

View.Set ("graphics:900;400,nobuttonbar") %frame manipulation
var pic : int := Pic.FileNew ("chucknorris3.jpg")
var pic2 : int := Pic.FileNew ("the world trade center.jpg")
var pic3 : int := Pic.FileNew ("wtc1.jpg")
var pic4 : int := Pic.FileNew ("world_trade_centre.jpg")
var font1 : int
var key : string (1)
var key1 : string (1)
var velocity, theta : real := 0
var x, y : int := 0
var timer : real := 0
var gravity : real := 1 %GRAVITY
var counter : int := 0

%draws Chuck
Pic.Draw (pic, 0, 0, picMerge)
%World Trade Center
Pic.Draw (pic2, 635, 0, picCopy)
%Title
font1 := Font.New ("Palatino:50:bold,italic")
assert font1 > 0
Font.Draw ("CannonChuck Game", 50, 290, font1, 12)
Font.Free (font1)
locatexy (300, 230)
put "Press any key to continue" ..
getch (key)
cls
%instructions
put ""
put ""
put "Hit the top of the World Trade Center with Chuck Norris to destroy it. Once the World Trade Center has been hit"
put "at the right spot by Chuck Norris, it will explode and sink to the ground. To shoot Chuck Norris, type in low"
put "digit integers for the initial power and angle of deployment."
put ""
put "Press any key to continue" ..
getch (key)
cls
loop
    x := 0
    y := 0
    timer := 0
    counter := 0
    cls
    Pic.Draw (pic, 0, 0, picMerge)
    %World Trade Center
    Pic.Draw (pic2, 635, 0, picCopy)
    %angle and power
    loop
        drawfillbox (0, 380, 400, 400, white)
        locatexy (0, 390)
        put "Enter an initial power (1 to 30): " ..
        View.Update
        get velocity
        locatexy (0, 390)
        drawfillbox (0, 380, 200, 400, 0)
        put "Enter an angle of deployment (0 to 90): " ..
        View.Update
        get theta
        exit when velocity <= 30 and theta <= 90
    end loop
    loop
        setscreen ("offscreenonly")
        Pic.Draw (pic, x, y, picMerge)
        delay (100)
        cls
        Pic.Draw (pic2, 635, 0, picCopy)
        Pic.Draw (pic, x, y, picMerge)
        View.Update
        x := round (x + velocity * timer * cosd (theta))
        y := round (y + velocity * timer * sind (theta) - 0.5 * gravity * timer * timer)
        timer := timer + 0.2
        View.Update
        exit when x >= 900
        exit when y < 0
        if x >= 700 and y >= 250 and y <= 350 then
            counter := counter + 1
        end if
    end loop
    cls
    View.Update
    if counter = 1 then
        put "You knocked down the World Trade Center with the swift blow of Chuck Norris!!"
        put "Would you like to play again?"
    elsif counter = 0 then
        put "You and Chuck are not buddies, shame on you."
        put "Would you like to play again?"
    end if
    put "Y or N: " ..
    View.Update
    get key1
    exit when key1 = "n" or key1 = "N"
end loop
I would give you the pictures, but i don't know how to upload them to you.
krisko
krisko
Mini Octorok
Mini Octorok

Male Number of posts : 16
Registration date : 2008-03-19

Back to top Go down

Turing --Help Empty Re: Turing --Help

Post  Onyx Wed Mar 19, 2008 9:08 pm

Cool.

To upload pictures this site has a really cool feature.

Simply click the "Host an Image" Button (Picture with a floppy disc in front of it) as you are typing your post, and you can automatically upload them.

You can also upload pictures by getting a photobucket account, ect.
Onyx
Onyx
Administrator
Administrator

Male Number of posts : 403
Registration date : 2007-11-09

G.W. Stats
Gangsta Name: Pimp Slap Sr.
Gang:

https://onyxplatform.forumotion.com

Back to top Go down

Turing --Help Empty Re: Turing --Help

Post  krisko Wed Mar 19, 2008 9:11 pm

I wanted to upload the picture file so you could try out my game. By the way, your help really helped me out a lot.
krisko
krisko
Mini Octorok
Mini Octorok

Male Number of posts : 16
Registration date : 2008-03-19

Back to top Go down

Turing --Help Empty Re: Turing --Help

Post  Onyx Wed Mar 19, 2008 9:25 pm

*Cracks knuckles, neck, leg, toes, and elbow bones*
yep all in a day\'s work.

As for the pictures, just upload em like I said.
It\'s easy Wink

looool, check this out.

I made this today...
Code:

%Scabies 3.0
%Fixed '/' Glitch
var scabecount : int := 9999
var scabex, scabey : array 1 .. scabecount of int
var keys : array char of boolean
var picId : int        %Variable for Picture
var scabespeed : int := 1
var handx, handy : int := 100
var hp : int := 198
var smallhp : real := 100
var tim : int := 0
var timecounter : int := 0
var sf1, sf2, sf3, sf4, sf5 : int := 0
var startingscabes : int


for a : 1 .. 9999
    randint (scabex (a), 0, 700)
    randint (scabey (a), 0, 500)
    %  randint (angle (a), 0,359)
    % randint (dir (a) ,0,1)
    % if dir(a) = 0 then
    % dir (a) :=-1
    % end if
end for

put "Type in the amount of scabes you would like to put into the atmosphere"
put "1-9999"
put""
put""
get startingscabes

scabecount := startingscabes
View.Set ("offscreenonly")
setscreen ("graphics:780;500,nobuttonbar")

loop
    cls
    picId := Pic.FileNew ("hand.bmp") %Pic must be in the same Folder as the Program
    Pic.Draw (picId, handx, handy, picMerge)      %X,and Y position of pic
    Pic.Free (picId)

    for x : 1 .. scabecount
        drawfilloval (scabex (x), scabey (x), 2, 2, 4)
    end for

    locatexy (10, 10)
    timecounter := timecounter + 1
    put "Time survived: ", tim ..
   

    if timecounter = 100 then
        tim := tim + 1
        timecounter := 0
    end if


    Input.KeyDown (keys)
    if handx > 0 then
        if keys (KEY_LEFT_ARROW) then
            handx := handx - 2
        end if
    end if
    if handx + 100 < 780 then
        if keys (KEY_RIGHT_ARROW) then
            handx := handx + 2
        end if
    end if

    if handy + 100 < 500 then
        if keys (KEY_UP_ARROW) then
            handy := handy + 2
        end if
    end if
    if handy > 0 then
        if keys (KEY_DOWN_ARROW) then
            handy := handy - 2
        end if
    end if

    drawbox (500, 50, 700, 70, 255)
    drawfillbox (501, 51, 501 + hp, 69, 10)
    View.Update



    if tim > 4 and (tim mod 5) = 0 then
        if sf5 = 0 then
            if scabecount < 9999 then
                scabecount := scabecount + 1
            end if
            for xxx : 1 .. scabecount
                randint (scabex (xxx), 0, 700)
                randint (scabey (xxx), 0, 500)
            end for
            sf5 := 1
        end if
    end if


    if tim > 4 and (tim mod 5) >= 1 then
        sf5 := 0
    end if

    for b : 1 .. scabecount
        if scabex (b) > handx + 50 then
            scabex (b) := scabex (b) - scabespeed
        elsif scabex (b) < handx + 50 then
            scabex (b) := scabex (b) + scabespeed
        end if

        if scabey (b) > handy + 50 then
            scabey (b) := scabey (b) - scabespeed
        elsif scabey (b) < handy + 50 then
            scabey (b) := scabey (b) + scabespeed
        end if
    end for

    for c : 1 .. scabecount
        if scabex (c) >= handx + 20 and scabex (c) <= handx + 80 and scabey (c) >= handy + 20 and scabey (c) <= handy + 80 then
            smallhp := smallhp - 10
        end if
    end for

    if smallhp < 0 then
        hp := hp - 1
        smallhp := 100
    end if
   
    exit when hp<0
end loop
 cls
    var font1 : int
    font1 := Font.New ("Times New Roman:60")
    assert font1 > 0
    Font.Draw ("You got Teh Scabes!", 50, 250, font1, 255)
    Font.Free (font1)
locatexy (250,10)
    put "There were ",scabecount, " Scabes on Screen"
    View.Update


Save this picture in the same spot as the game.
Turing --Help Hand

Oh, and if you want a good challenge, simply go to this section:

scabecount := 1
View.Set (\"offscreenonly\")
setscreen (\"graphics:780;500,nobuttonbar\")

change the scabecount to.. say 100. Have fun. Twisted Evil

----------

Also I just discovered the whole upload picture from this site doesn't work... Embarassed

Just go to www.photobucket.com

Register there (it's free), and upload pictures. Then once the pic is uploaded, copy and past the [img] code, and paste it into your post.


Last edited by Onyx on Thu Mar 20, 2008 12:44 pm; edited 3 times in total
Onyx
Onyx
Administrator
Administrator

Male Number of posts : 403
Registration date : 2007-11-09

G.W. Stats
Gangsta Name: Pimp Slap Sr.
Gang:

https://onyxplatform.forumotion.com

Back to top Go down

Turing --Help Empty Re: Turing --Help

Post  krisko Wed Mar 19, 2008 9:30 pm

How do i get a photobucket account? Also when go to upload picture it gives three options, thumbnail, image or image url. It has a url under each and a copy button beside each and an upload link on the bottom. Am i supposed to decide then click copy then click upload?
krisko
krisko
Mini Octorok
Mini Octorok

Male Number of posts : 16
Registration date : 2008-03-19

Back to top Go down

Turing --Help Empty Re: Turing --Help

Post  krisko Wed Mar 19, 2008 10:15 pm

I got illegal character '\'
bolded was error

scabecount := 1
View.Set (\"offscreenonly\")
setscreen (\"graphics:780;500,nobuttonbar\")

loop
cls
picId := Pic.FileNew (\"hand.bmp\") %Pic must be in the same Folder as the Program
Pic.Draw (picId, handx, handy, picMerge) %X,and Y position of pic
Pic.Free (picId)

for x : 1 .. scabecount
drawfilloval (scabex (x), scabey (x), 2, 2, 4)
end for

locatexy (10, 10)
timecounter := timecounter + 1
put \"Time survived: \", tim ..
krisko
krisko
Mini Octorok
Mini Octorok

Male Number of posts : 16
Registration date : 2008-03-19

Back to top Go down

Turing --Help Empty Re: Turing --Help

Post  krisko Wed Mar 19, 2008 10:17 pm

here is the pics
Turing --Help Theworldtradecenter
Turing --Help Chucknorris3
krisko
krisko
Mini Octorok
Mini Octorok

Male Number of posts : 16
Registration date : 2008-03-19

Back to top Go down

Turing --Help Empty Re: Turing --Help

Post  Onyx Wed Mar 19, 2008 10:22 pm

Cool. I'll play that. Oh, I and fixed mine as well. I have no idea where those slashes came from Neutral

Wierd.

Just copy the New code from the old spot Wink

Anyways, I'm goin to bed, I got a splitting headache right now Mad
Onyx
Onyx
Administrator
Administrator

Male Number of posts : 403
Registration date : 2007-11-09

G.W. Stats
Gangsta Name: Pimp Slap Sr.
Gang:

https://onyxplatform.forumotion.com

Back to top Go down

Turing --Help Empty Re: Turing --Help

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum