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

Username:   Password: 
 RegisterRegister   
 1 player game dosn't work won't draw or move well 2 player game works
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
yumrum




PostPosted: Sat May 30, 2009 11:40 am   Post subject: 1 player game dosn't work won't draw or move well 2 player game works

What is it you are trying to achieve?
I am try add a one player version to tag game were circles are added after time and move around on their own
I want player one to work again

What is the problem you are having?
I don't know how to make a circle move by it's self and bounce off the walls
Player one dosn't move
You have to click off the screen and back to make background appear

Describe what you have tried to solve this problem
I havn't really tried anything because i don't know where to start and i didn't really get the tutorials.

for the second two problems i used all the same codding as 2 player but the result were it didn't work

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
My Tag game %%%%%%%%%%%%%%%%%%%% shows were the one player thing is

Turing:

% 1 player or two player
var playerinfo : int

%FONTS
var font1, font2, font3, font4 : int
font1 := Font.New ("sans serif:18:bold")
font2 := Font.New ("sans serif:36:bold")
font3 := Font.New ("mono:20")
font4 := Font.New ("Palatino:40:Bold,Italic")
var page2 : int := Pic.FileNew ("tag-your-it.bmp")

%pic
var background : int := Pic.FileNew ("My Map 1.bmp")
var Grass : int := Pic.FileNew ("Grass.bmp")

% Opening Screen
Music.PlayFileLoop ("Canon.mp3")

setscreen ("graphics:600;600")
Draw.FillBox (1000, 1000, 0, 0, black)
Draw.Text ("TAG UR IT", 190, 500, font2, brightred)
Draw.Text ("The goal is to touch the other player", 120, 450, font1, yellow)
Draw.Text ("A,W,S,D controls the green dot", 140, 400, font1, yellow)
Draw.Text ("Arrow Keys control the red dot", 140, 350, font1, yellow)
Draw.Text ("The Game will begin shortly", 155, 300, font1, yellow)
Pic.Draw (page2, 200, 0, picMerge)
delay (5000)
cls

%second screen
Draw.FillBox (1000, 1000, 0, 0, black)
Draw.Text ("O resets the screen", 80, 500, font3, yellow)
Draw.Text (" L and K are for invisiblity for red", 10, 450, font3, yellow)
Draw.Text (" E and Q are for invisiblity for Blue", 5, 400, font3, yellow)
Draw.Text (" Red means your it", 80, 350, font3, brightgreen)
Draw.Text (" Hit 1 for one player", 80, 300, font3, brightred)
Draw.Text (" Hit 2 for two player", 80, 250, font3, brightred)
get playerinfo


% Setting Screen size
setscreen ("graphics:1200;600,offscreenonly")

% Variables
var x, y, x1, y1 : int % positions

% SKILLS
var p1sk : int := 0
var p2sk : int := 0

% Time
var runingtime : int


% People and whose it
var colours, colours2 : int % Colour / if it
var p1 : int := 12 % player 1
var p2 : int := 9  % player 2
var r : int := 1
var z : int := 1

% Score
var p1s, p2s : int := 0

% what things equal
x := 10
y := 10
x1 := 1190
y1 := 590
colours := p1
colours2 := p2

% Movement
var chars : array char of boolean

% ONE PLAYER%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if playerinfo = 1 then
    loop
        cls

        Draw.FillBox (1200, 600, 0, 0, green)

        Input.KeyDown (chars)

        %Player 1
        if chars (KEY_UP_ARROW) then
            y := y + 5
        end if
        if chars (KEY_RIGHT_ARROW) then
            x := x + 5
        end if
        if chars (KEY_LEFT_ARROW) then
            x := x - 5
        end if
        if chars (KEY_DOWN_ARROW) then
            y := y - 5
        end if

        %Glitch Fix
        if chars ('o') then
            x := 10
            y := 10
            colours := p1
        end if

        % Teleport Secret player 1 top right cornor
        if chars ('/') then
            x := 10
            y := 590
        end if

        %Invisiblity
        %player 1 invisibility
        if chars ('l') and p1sk < 3 then
            colours := green
            p1sk := p1sk + 1
        end if
        if chars ('k') then
            if r = 1 then
                colours := 12
            elsif r = 0 then
                colours := 9
            end if

            %Sides PLAYER 1
            if x = 1200 then
                x := 5
            end if

            if x = 0 then
                x := 1195
            end if

            if y = 600 then
                y := 5
            end if

            if y = 0 then
                y := 595
            end if

            % Draw person
            drawfilloval (x, y, 10, 10, colours)
            View.Update
            delay (15)

        end if

    end loop
end if%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%TWO PLAYER TAG
if playerinfo = 2 then

    %runingtime := Time.Elapsed
    loop
        cls
        Draw.FillBox (1200, 600, 0, 0, green)

        Input.KeyDown (chars)

        %Player 1
        if chars (KEY_UP_ARROW) then
            y := y + 5
        end if
        if chars (KEY_RIGHT_ARROW) then
            x := x + 5
        end if
        if chars (KEY_LEFT_ARROW) then
            x := x - 5
        end if
        if chars (KEY_DOWN_ARROW) then
            y := y - 5
        end if

        % Player 2
        if chars ('w') then
            y1 := y1 + 5
        end if
        if chars ('d') then
            x1 := x1 + 5
        end if
        if chars ('a') then
            x1 := x1 - 5
        end if
        if chars ('s') then
            y1 := y1 - 5
        end if

        %Glitch fix
        if chars ('o') then
            x := 10
            y := 10
            x1 := 1190
            y1 := 590
            colours := p1
            colours2 := p2
            p1s := 0
            p2s := 0
        end if

        % Teleport Secret player 1 top right cornor
        if chars ('/') then
            x := 10
            y := 590
        end if
        % Teleport Secret Player 2 bottom left cornor
        if chars ('x') then
            x1 := 1190
            y1 := 10
        end if

        % IT p1 % Player 1 going from red to blue
        if x < x1 + 15 and x > x1 - 15 and colours = p1 and y < y1 + 15 and y > y1 - 15 then

            cls
            %Fixing whos it
            p1s := p1s + 1
            colours := p2
            colours2 := p1
            r := 0
            z := 0
            p1sk := 0
            p2sk := 0

            % Screen set up
            setscreen ("graphics:600;600")
            Draw.FillBox (1200, 600, 0, 0, black)
            Draw.Text ("Player 1 and 2 Scores", 100, 450, font3, yellow)

            %Player 1 score
            colorback (7)
            color (12)
            locatexy (180, 400)
            put p1s

            %Player 2 score
            locatexy (480, 400)
            colorback (7)
            color (12)
            put p2s
            Draw.Text ("Player 2 Score", 350, 450, font3, yellow)

            % Screen set up
            delay (2000)
            setscreen ("graphics:1200;600")

            %Resetting start spot
            x := 10
            y := 10
            x1 := 1190
            y1 := 590
        end if

        % IT p2 % Player 2 going from red to blue
        if x1 < x + 15 and x1 > x - 15 and colours2 = p1 and y1 < y + 15 and y1 > y - 15 then

            cls
            %Fixing who's it
            p2s := p2s + 1
            colours := p1
            colours2 := p2
            z := 1
            r := 1
            p1sk := 0
            p2sk := 0

            % Screen Set up
            setscreen ("graphics:600;600")
            Draw.FillBox (1200, 600, 0, 0, black)

            % Player 1 score
            Draw.Text ("Player 1 and 2 Scores", 100, 450, font3, yellow)
            colorback (7)
            color (12)
            locatexy (180, 400)
            put p1s

            % Player 2 score
            locatexy (480, 400)
            colorback (7)
            color (12)
            put p2s
            Draw.Text ("Player 2 Score", 350, 450, font3, yellow)

            % Screen Set up
            delay (2000)
            setscreen ("graphics:1200;600")

            % reseting start spot
            x := 10
            y := 10
            x1 := 1190
            y1 := 590
        end if

        %Invisiblity
        %player 1 invisibility
        if chars ('l') and p1sk < 3 then
            colours := green
            p1sk := p1sk + 1
        end if
        if chars ('k') then
            if r = 1 then
                colours := 12
            elsif r = 0 then
                colours := 9
            end if
        end if

        %Player 2 invisibitlty
        if chars ('e') and p2sk < 3 then
            colours2 := green
            p2sk := p2sk + 1
        end if
        if chars ('q') and z = 1 then
            colours2 := 9
        end if
        if chars ('q') and z = 0 then
            colours2 := 12
        end if

        % SIDES

        % pLAYER 1
        if x = 1200 then
            x := 5
        end if

        if x = 0 then
            x := 1195
        end if

        if y = 600 then
            y := 5
        end if

        if y = 0 then
            y := 595
        end if

        % Player 2
        if x1 = 1200 then
            x1 := 5
        end if

        if x1 = 0 then
            x1 := 1195
        end if

        if y1 = 600 then
            y1 := 5
        end if

        if y1 = 0 then
            y1 := 595
        end if


        % Drawing People
        drawfilloval (x1, y1, 10, 10, colours2)
        drawfilloval (x, y, 10, 10, colours)
        View.Update
        delay (15)

        exit when p1s + p2s = 10
    end loop
    Music.PlayFileStop
    %put "This program has been going for " ,runingtime
end if




Please specify what version of Turing you are using
4.1
Sponsor
Sponsor
Sponsor
sponsor
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  [ 1 Posts ]
Jump to:   


Style:  
Search: