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

Username:   Password: 
 RegisterRegister   
 Maze Level help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
devyn2748




PostPosted: Mon Jun 17, 2019 1:50 pm   Post subject: Maze Level help

What is it you are trying to achieve?
To make it so when you lose on a level it brings you back to the first level


What is the problem you are having?
I cannot get it to go back to the first level when you lose


Describe what you have tried to solve this problem
ive tried looping it, currently once you lose it just ends the game


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Turing:

import GUI
var font1 : int := Font.New ("Didot:22")
var pic : int
var pic2 : int
pic := Pic.FileNew ("title.jpg")
pic2 := Pic.FileNew ("fail.jpg")
var x, y, b : int
var state : int := 0

%Game Procedures!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

procedure game
    loop
        Mouse.Where (x, y, b)
        locate (1, 1)
        put View.WhatDotColor (x, y), " " ..
        exit when View.WhatDotColor (x, y) = red
        if View.WhatDotColor (x, y) not= 9 then
            cls
            Pic.Draw (pic2, 100, 0, picCopy)
            Music.PlayFile ("loss.wav")
            delay (2000)
            cls
            loop
                Font.Draw ("You Lost! Exit the game NOW!", 150, 190, font1, brightred)
                delay (3000)
                quit
            end loop
        end if
    end loop
end game

procedure gameStart
    loop
        Draw.FillOval (20, 200, 10, 10, 9)
        Font.Draw ("To begin place your mouse on the blue circle", 50, 190, font1, brightred)
        Mouse.Where (x, y, b)
        locate (1, 1)
        put View.WhatDotColor (x, y), " " ..
        delay (1200)
        exit when View.WhatDotColor (x, y) = 9
    end loop
end gameStart

%Game%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

colorback (black)
cls

Pic.Draw (pic, 0, 0, picCopy)
Font.Draw ("Welcome to Scary Maze!", 150, 200, font1, brightred)
delay (4000)
cls

gameStart
cls

Draw.FillBox (0, 180, maxx, 220, 9)
Draw.FillBox (600, 180, 640, 220, red)

game

cls

Font.Draw ("Level 2", 50, 190, font1, brightred)
delay (2000)
cls

gameStart

cls

Draw.FillBox (0, 180, 150, 220, 9)
Draw.FillBox (150, 190, 230, 210, 9)
Draw.FillBox (230, 190, 250, 300, 9)
Draw.FillBox (230, 280, 400, 300, 9)
Draw.FillBox (400, 300, 420, 100, 9)
Draw.FillBox (420, 100, maxx, 120, 9)
Draw.FillBox (600, 100, maxx, 120, red)

game

cls

Font.Draw ("Level 3", 50, 190, font1, brightred)
delay (2000)
cls

gameStart

cls

Draw.FillBox (0, 190, 150, 210, 9)
Draw.FillBox (150, 210, 170, 50, 9)
Draw.FillBox (170, 50, 200, 70, 9)
Draw.FillBox (200, 70, 220, 20, 9)
Draw.FillBox (220, 20, 280, 40, 9)
Draw.FillBox (280, 20, 300, 350, 9)
Draw.FillBox (280, 20, 300, 350, 9)
Draw.FillBox (280, 350, 500, 370, 9)
Draw.FillBox (500, 370, 520, 190, 9)
Draw.FillBox (520, 210, maxx, 190, 9)
Draw.FillBox (600, 210, maxx, 190, red)

game

cls

Font.Draw ("Level 4", 50, 190, font1, brightred)
delay (2000)
cls




Please specify what version of Turing you are using
Turing 4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Tue Jun 18, 2019 9:14 am   Post subject: RE:Maze Level help

It may help to also post a copy of title.jpg and fail.jpg so others can run your program.

Also can you show us how you are adding the loop when trying to make it restart?
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
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: