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

Username:   Password: 
 RegisterRegister   
 Just a question, and some guidance needed please!
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Raknarg




PostPosted: Wed Sep 11, 2013 6:30 pm   Post subject: RE:Just a question, and some guidance needed please!

I dont see why you need that statement in there in the first place.
Sponsor
Sponsor
Sponsor
sponsor
slender0123




PostPosted: Wed Sep 11, 2013 6:51 pm   Post subject: RE:Just a question, and some guidance needed please!

I know, im going to mess around with the original key up arrow statement, so that if the ball isnt moving, i can jump, but if its moving up or down, it cant move.
slender0123




PostPosted: Thu Sep 12, 2013 3:22 pm   Post subject: RE:Just a question, and some guidance needed please!

Well, I sorta got it going, theres a height limit for jumping sadly though, im still working it out slowly.

my game coding now

code:

const Gravity := 2
var x, y := 100
var y_velocity := 0
var keys : array char of boolean
var tiles : array 0..35, 0..35 of int
setscreen ("offscreenonly,graphics:500;400")
var Height := 150
var Length := 150
var try : string


loop
    Input.KeyDown (keys)
    if keys (KEY_UP_ARROW) and y_velocity = 0 and y <= 100 then
        y_velocity := 30
    end if
    if keys (KEY_LEFT_ARROW) and x > 0 then
        x -= 10
    end if
    if keys (KEY_RIGHT_ARROW) and x < maxx then
        x+= 10
    end if
   
        y_velocity -= Gravity   
    y += y_velocity 

    if y < 0 then 
        y := 0
        y_velocity := 0
    end if
   
if Math.DistancePointLine (x, y, 50, 100, 150, 100) < 15 then
    if y_velocity < 0 then 
        y := 100
        y_velocity := 0
    else   
    y_velocity := y_velocity * -1
    end if
end if

if Math.DistancePointLine (x, y, 300, 0, 300, 200) < 15 then
   put "Game Over!"
   
exit
end if

if Math.DistancePointLine (x, y, 0, 300, 215, 300) < 15 then
   put "Game Over!"
exit
end if

if Math.DistancePointLine (x, y, 500, 300, 300, 300) < 15 then
   put "Game Over!"
exit
end if

if Math.DistancePointLine (x, y, 350, 100, 450, 100) < 15 then
    if y_velocity < 0 then
        y := 100
        y_velocity := 0
    else   
    y_velocity := y_velocity * -1
    end if
end if


if Math.DistancePointLine (x, y, 300, 0, 700, 0) < 15 then
   put "Game Over!"
exit
end if

if Math.DistancePointLine (x, y, 0,0,300,0) < 15 then
   put "Game Over!"
exit
end if


 
   
    Draw.FillOval(x,y,15,15,blue)
    drawline(50,100,150,100,black)
    drawline(300,0,300,200,brightred)
    drawline(0,300,215,300,brightred)
    drawline(500,300,300,300,brightred)
    drawline(350,100,450,100,black)
    drawline(300,0,700,0,brightred)
    drawline(0,0,300,0,brightred)
    View.Update
    delay (15)
    cls
end loop


Im also trying to have it so when you die, you have a choice to retry or not.
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 2 of 2  [ 18 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: