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

Username:   Password: 
 RegisterRegister   
 Climbing ladders and jumping
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
munt4life




PostPosted: Wed May 04, 2011 6:06 pm   Post subject: Climbing ladders and jumping

What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>


What is the problem you are having?
<Answer Here>


Describe what you have tried to solve this problem
<Answer Here>


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

Turing:



var bulletsX, bulletsY : flexible array 1 .. 0 of int
var deadbullet : flexible array 1 .. 0 of boolean
var chars : array char of boolean
var counter : int := 50                          % array for shooting glitchy
var x : int := 450
var smallTank : int := Pic.FileNew ("smalltank.bmp")
var bullet : int := Pic.FileNew ("bullet.bmp")
setscreen ("graphics:1100;max,")
setscreen ("offscreenonly")
var y : int
var caution : int := black
var finishOne : int := 12
var font1 : int
font1 := Font.New ("Jokerman:72")
assert font1 > 0
var font2 : int
font2 := Font.New ("Arial:72")
assert font2 > 0
var direction : boolean := false
var level : int := 1             % presets level to main menu
x := 100
y := 400
var x1, x2, y1, y2 : int
x1 := 450
x2 := 475
y1 := 470
y2 := 500
var x3, y3, x4, y4 : int
x3 := 550
x4 := 575
y3 := 470
y4 := 500
var mx, my, mb : int
var direction2 : boolean := false
var font3 : int
var direction3 : boolean := false
var direction5: boolean :=false
var direction6 : boolean :=false
var direction7 : boolean :=false
var direction8 : boolean :=false
font3 := Font.New ("Andalus:26")
assert font3 > 0

var theta : real
var speedx, speedy : int := 15
var compy, compx : int
compx := 500
compy := 100
var compx2,compy2 : int
compx2 :=200
compy2:=700
var dirx : int :=60
var diry : int :=175
var dirx2 : int :=60
var diry2: int :=300
var dirx3 : int :=800
var diry3 :int :=175
var dirx4 : int :=800
var diry4: int :=300

%^^variable definitions

% procedure mainMenu ( var font1 : int, var font2 : int)     % main menu giving 3  options
% drawfillbox(0,0,maxx,maxy,white)
%  Font.Draw ("Play", 300, 550, font1, cyan)
%  Font.Draw("How to play " ,300,350,font2,black)
% end mainMenu

procedure backgroundOne (var x1 : int, var x2 : int, var y1 : int, var y2 : int, var x3 : int, var y3 : int, var x4 : int, var y4 : int)
    var levelOne : int := Pic.FileNew ("gord4.jpg")
    Pic.Draw (levelOne, 0, 0, 0)
    Pic.Free (levelOne)
    drawfillbox (x1, y1, x2, y2, blue)
    drawfillbox (x3, y3, x4, y4, blue)
    if direction = false then
        y2 := y2 - 25
        y1 := y1 - 25
    end if
    if direction = true then
        y2 := y2 + 25
        y1 := y1 + 25
    end if
    if y2 > 580 then
        direction := false
    end if
    if y2 < 20 then
        direction := true
    end if
    if direction3 = false then
        y4 := y4 - 25
        y3 := y3 - 25
    end if
    if direction3 = true then
        y3 := y3 + 25
        y4 := y4 + 25
    end if
    if y4 > 580 then
        direction3 := false
    end if
    if y4 < 20 then
        direction3 := true
    end if

    if whatdotcolor (x, y) = black then
        drawfillbox (0, 0, maxx, maxy, white)
        Font.Draw ("YOU LOSE :(!!", 100, 50, font1, red)
        break
    end if

    if whatdotcolor (x, y) = blue then
        drawfillbox (0, 0, maxx, maxy, white)
        Font.Draw ("YOU LOSE :(!!", 100, 50, font1, red)
        break
    end if


    if whatdotcolor (x, y) = 12 then     % finish mark for level 1
        level := level + 1
        y := 100
        x := 100
    end if

end backgroundOne

procedure backgroundTwo (var x1 : int, var y1 : int)                          % level 2
    var levelTwo : int := Pic.FileNew ("gord23.jpg")
    Pic.Draw (levelTwo, 0, 0, 0)
    Pic.Free (levelTwo)

    drawfillbox (x1, y1, x1 + 15, y1 + 15, red)
    y1 := 600
    if direction2 = true then
        x1 := x1 + 45
    end if
    if direction2 = false then
        x1 := x1 - 45
    end if
    if x1 < 15 then
        direction2 := true
    end if
    if x1 > maxx - 20 then
        direction2 := false
    end if
    drawfillbox(dirx,diry,dirx+15,diry+15,red)
    if direction5 = true then
        dirx := dirx + 35
    end if
    if direction5 = false then
        dirx := dirx - 35
    end if
    if dirx < 10 then
        direction5 := true
    end if
    if dirx > 285 then
        direction5 := false
    end if
   
    drawfillbox(dirx2,diry2,dirx2+15,diry2+15,red)
    if direction6 = true then
        dirx2 := dirx2 + 35
    end if
    if direction6 = false then
        dirx2 := dirx2 - 35
    end if
    if dirx2 < 15 then
        direction6 := true
    end if
    if dirx2 > 285 then
        direction6 := false
    end if
   
    drawfillbox(dirx3,diry3,dirx3+15,diry+15,red)
    if direction7 = true then
        dirx3 := dirx3 + 35
    end if
    if direction7 = false then
        dirx3 := dirx3 - 35
    end if
    if dirx3 < 850 then
        direction7 := true
    end if
    if dirx3 > maxx - 20 then
        direction7 := false
    end if
    drawfillbox(dirx4,diry4,dirx4+15,diry4+15,red)
    if direction8 = true then
        dirx4 := dirx4 + 45
    end if
    if direction8 = false then
        dirx4 := dirx4 - 45
    end if
    if dirx4 < 825 then
        direction8 := true
    end if
    if dirx4 > maxx - 20 then
        direction8 := false
    end if
    drawfillbox (compx, compy, compx + 10, compy + 10, red)
    drawfillbox(compx2,compy2,compx2+20,compy2+20,red)
   
    if (compx < x) then
        compx += 10
    end if
    if (compx > x) then
        compx -= 10
    end if
    if (compy > y) then
        compy -= 10
    end if
    if (compy < y) then
        compy += 10
    end if
       if (compx2 < x) then
        compx2 += 11
    end if
    if (compx2 > x) then
        compx2 -= 11
    end if
    if (compy2 > y) then
        compy2 -= 11
    end if
    if (compy2 < y) then
        compy2 += 11
    end if
    drawfillbox(875,10,900,20,green)

    if whatdotcolor(x,y) = black then
    break
    end if
    if whatdotcolor (x, y) = red then
        break
    end if
   
    if whatdotcolor (x,y) = green then
    level:=3
    end if
end backgroundTwo
proc backgroundThree( var x1 : int)           % level three
   var levelThree : int := Pic.FileNew ("level4.jpg")
    Pic.Draw (levelThree, 0, 0, 0)
    Pic.Free (levelThree)
    if x = 200 then
    y:=y+15
    end if
 

end backgroundThree

loop
    Input.KeyDown (chars)

    if chars (KEY_UP_ARROW) and y < 660 and level not = 3  then
        y := y + 15
    end if
    if chars (KEY_RIGHT_ARROW) and x < maxx - 10 then
        x := x + 15
    end if
    if chars (KEY_LEFT_ARROW) and x > 10 then
        x := x - 15
    end if
    if chars (KEY_DOWN_ARROW) and y > 10 and level not = 3  then
        y := y - 15
    end if
    %
    % if level = 0 then
    % mainMenu(font1,font2)
    % end if

    if level = 1 then
        backgroundOne (x1, x2, y1, y2, x3, y3, x4, y4)
        end if
  if level = 2 then
        backgroundTwo (x1, y1)
    end if
   if level = 3 then
    backgroundThree(x1)
    end if
    drawoval (x, y, 4, 4, blue)
    View.Update
end loop




Please specify what version of Turing you are using
<Answer Here>



level4.JPG
 Description:
 Filesize:  39.62 KB
 Viewed:  82 Time(s)

level4.JPG



gord23.jpg
 Description:
 Filesize:  28.17 KB
 Viewed:  81 Time(s)

gord23.jpg



gord4.jpg
 Description:
 Filesize:  25.7 KB
 Viewed:  83 Time(s)

gord4.jpg


Sponsor
Sponsor
Sponsor
sponsor
munt4life




PostPosted: Wed May 04, 2011 6:10 pm   Post subject: RE:Climbing ladders and jumping

forget the variables in the begining for the bullets that is later for level 4, K guys basically for the third level i wanted it to go up the brown ladders and jump when i pressed up, but u can only go down if ur on a ladder please give me tips on what i should do. Also i called the third level level4.jpg so bear with me :p
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: