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

Username:   Password: 
 RegisterRegister   
 i need help with a game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Womble




PostPosted: Mon Jan 15, 2018 2:34 pm   Post subject: i need help with a game

so im trying to make a simple game where you doge objects coming towards you. How could i make it show multiple objects coming at me at once and how could i make it detect that i got hit if anyone could help that would be great Very Happy

code:

setscreen ("graphics:800;600")
var chars : array char of boolean
var x, y : int
var enemyy1, enemyy2 : int
var enemyx1, enemyx2: int := 0
enemyy1 := Rand.Int (20, 600)
enemyy2 := Rand.Int (20, 600)
x := 700
y := 300

loop
    Input.KeyDown (chars)
    % move character
    if chars (KEY_RIGHT_ARROW) then
        y := y + 5
    end if
    if chars (KEY_LEFT_ARROW) then
        y := y - 5
    end if
    %character
    drawoval (x, y, 10, 10, red)
    %enemy
    drawoval (enemyx1, enemyy1, 10, 10, blue)
    drawoval (enemyx2, enemyy2, 10, 10, black)
    delay (20)
    cls
    enemyx1 := enemyx1 + 3
    enemyx2 := enemyx2 + 3
    put enemyx1
    put enemyx2

end loop
Sponsor
Sponsor
Sponsor
sponsor
TokenHerbz




PostPosted: Tue Jan 16, 2018 9:48 pm   Post subject: RE:i need help with a game

i meant to click the other post, i'll revisit this, dont see a delete,

**Okay so i read your question, and the simple answer is arrays. take a look here to learn more!! --> http://compsci.ca/v3/viewtopic.php?t=14333

and check out this post on collisition detection!! http://compsci.ca/v3/viewtopic.php?t=13661
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: