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

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




PostPosted: Thu Mar 07, 2013 8:01 pm   Post subject: Snake Game Help

What is it you are trying to achieve?
trying to get the astericts to follow the @ symbol


What is the problem you are having?
it wont do it and i have no clue why.. :/

Turing:


%Emmanuel Cunningham

%Snake Game

%Varibles
setscreen ("graphics:1200;600")
var row, col, snaker, skanec : int := 25
var snakeleng : int := 1
var chars : array char of boolean
var snakefr : int := Rand.Int (1, 37)
var snakefc : int := Rand.Int (1, 150)
var food : string := "*"
var score : int := 0


procedure CheckFood
    if row = snakefr and col = snakefc then
        score := score + 10
        snakefr := Rand.Int (1, 37)
        snakefc := Rand.Int (1, 150)
        locate (snakefr, snakefc)
        put "*"
    end if
end CheckFood

procedure Food
    loop
        if row = snakefr and col = snakefc then
            locate (row - 1, col)
            put "*" ..
        end if
    end loop
end Food

procedure Move
    loop % Main game loop
        locate (row, col)
        put "@" ..
        delay (100)
        locate (row, col)
        put " " ..
        if hasch then
            Input.KeyDown (chars)
        end if
        if chars (KEY_UP_ARROW) then
            row := row - 1
        elsif chars (KEY_DOWN_ARROW) then
            row := row + 1
        elsif chars (KEY_RIGHT_ARROW) then
            col := col + 1
        elsif chars (KEY_LEFT_ARROW) then
            col := col - 1
        else

        end if
        CheckFood
        locate (1, 1)
        put "Your Score Is ", score
        exit when chars ('q')
    end loop

end Move


%Mainline
locate (row, col) % set position and set coords
put "@" ..

locate (snakefr, snakefc)
put "*"
Input.KeyDown (chars)

Move





Please specify what version of Turing you are using
4.11 or the open turing editor
Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: Thu Mar 07, 2013 9:02 pm   Post subject: Re: Snake Game Help

Well, what is supposed to print the asterisks behind the @?
Dazzle




PostPosted: Fri Mar 08, 2013 10:22 am   Post subject: RE:Snake Game Help

i was just wondering how you would do it and i dont want to draw "@" symbol i want to draw "*" behind it
Raknarg




PostPosted: Sat Mar 09, 2013 6:16 pm   Post subject: RE:Snake Game Help

He's saying you never draw the asterisks in the first place.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: