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

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




PostPosted: Tue May 14, 2013 7:13 pm   Post subject: Turing Assistance

Hey guys,

I just need some assisstance as to what I should do. So for my final assignment, we are suppose to create a game and i want to create a game very similar to this :
http://www.albinoblacksheep.com/games/falldown2
however i am struggling because I really have no clue where I have to start. What should I do? Would someone please give me some guidance as to what steps I should take? Thanks
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Tue May 14, 2013 7:17 pm   Post subject: RE:Turing Assistance

Start by making a ball you can control with the keyboard.
adrianr2z




PostPosted: Wed May 15, 2013 5:08 pm   Post subject: Re: Turing Assistance

Ok I did, but my two biggest questions are:

Can I randomly place the blocks and have a little space for the ball to escape from?

Also, How would I make the screen keep going up and making it a never ending until the screen reaches the ball?
Panphobia




PostPosted: Wed May 15, 2013 5:14 pm   Post subject: RE:Turing Assistance

I would probably make 30-40 different arrangement of blocks and randomly pick then to be placed on screen, and also making the game finish when the ball hits the top is a simple if statement.
Raknarg




PostPosted: Wed May 15, 2013 5:48 pm   Post subject: RE:Turing Assistance

Instead of arrangements Panphobia, you can do something like this:

Turing:

var space : int := Rand.Int (50, maxx - 50)

loop
     game ()
     drawblock_to_space ()
     drawblock_from_space_plus50 ()
     if character_is_in_space () then
          drop_character ()
     end if
end loop
jr5000pwp




PostPosted: Thu May 16, 2013 11:55 am   Post subject: RE:Turing Assistance

My approach would be to make a gravity/collision simulation engine without screen movement first, then add it in afterwards. As for the blocks, I would do tiles. Have an array of booleans representing tiles from left to right, and make holes by setting tiles to false. You can have a generator that makes it more likely to have more holes the sooner into the game you are, thus making the movement harder even without the constantly increasing screen speed.
As for infinite-ness, I would use an approach similar to that of any other infinite game and generate as you go, adding elements to your row collection and removing them when they leave the screen.
As I mentioned, to avoid confusion, you should probably do screen movement last.
Raknarg




PostPosted: Thu May 16, 2013 6:24 pm   Post subject: RE:Turing Assistance

There's no point in adding and removing elements, that's needlessly costly. Just recycle elements instead.
adrianr2z




PostPosted: Tue May 21, 2013 5:51 pm   Post subject: Re: Turing Assistance

This is turning out to be such a PAIN IN THE BEHIND! I worked on it and i've gotten this far however it like feels weird and not right. Goes through the bricks even with collision checks and just doesn't seem right. Could someone take a look at the code and give me some feedback?

*Note** A lot of the coding was done with the help of my teacher. I mean alot of help. He told me that I'm on my own and that he can't do the project for me so I really need more assistance how I should proceed.

Turing:

View.Set ("graphics:max;max,nobuttonbar, offscreenonly")
%Introducing variables

var ballx, bally : int
var ballradius : int := 20
ballx := maxx div 2
bally := maxy - ballradius
var blockx1, blockx2, blocky1, blocky2 : int
blockx1 := 100
blockx2 := maxx div 2
blocky1 := 0
blocky2 := 50
var space : int := Rand.Int (50, maxx - 50)
var chars : array char of boolean
var spots : array 1 .. 500, 1 .. 2 of int
var newspot : boolean := false
var xvalue, width : int := 0
var numSpots : int
% create one spot and place on screen

numSpots := 1
loop
    randint (width, 0, 150)   % sets the x location
    xvalue := xvalue + 20 + width
    spots (numSpots, 2) := 0
    spots (numSpots, 1) := xvalue

    exit when xvalue >= maxx
    numSpots := numSpots + 1
end loop

put numSpots
loop

    Draw.FillOval (ballx, bally, ballradius, ballradius, brightgreen)
    bally := bally - 1

    if bally - 1 = 0 then
    bally := maxy - ballradius
    end if



    for i : 1 .. numSpots

        Draw.FillBox (spots (i, 1), spots (i, 2), spots (i, 1) + 100, spots (i, 2) + 20, black)
    end for



    for i : 1 .. numSpots

        spots (i, 2) := spots (i, 2) + 1
        if spots (i, 2) = maxx div 10 then
            newspot := true

        end if
    end for

    if newspot = true then
        xvalue := 0
        loop
            numSpots := numSpots + 1

            randint (width, 0, 150)     % sets the x location
            xvalue := xvalue + 20 + width
            spots (numSpots, 2) := 0
            spots (numSpots, 1) := xvalue

            exit when xvalue >= maxx
        end loop
        newspot:= false
    end if
    %Checks for collision between ball and block
    for i : 1 .. numSpots
        if bally - ballradius >= spots (i, 2) and bally - ballradius <= spots (i, 2) + 20 and ballx - ballradius <= spots (i, 1) + 100 and ballx + ballradius >= spots (i, 1) then
            bally := bally + 2
        end if
    end for

    Input.KeyDown (chars)
    if chars (KEY_RIGHT_ARROW) and ballx + ballradius <= maxx then
        ballx := ballx + 2
    elsif chars (KEY_LEFT_ARROW) and ballx - ballradius >= 0 then
        ballx := ballx - 2
    end if


    View.Update
    cls


    exit when bally - ballradius > maxy


end loop
Sponsor
Sponsor
Sponsor
sponsor
adrianr2z




PostPosted: Sat May 25, 2013 6:14 pm   Post subject: Re: Turing Assistance

any help?
Dreadnought




PostPosted: Sat May 25, 2013 7:10 pm   Post subject: Re: Turing Assistance

Well the game slows down the longer you play and eventually crashes, so you could always try to fix that. You're being pretty inefficient in some places (ex: keeping blocks you don't need) so you could also look into that.
Zren




PostPosted: Sun May 26, 2013 6:15 pm   Post subject: RE:Turing Assistance

You might want to guarantee all the open spots are larger than the ball.

Posted Image, might have been reduced in size. Click Image to view fullscreen.
adrianr2z




PostPosted: Sun May 26, 2013 8:21 pm   Post subject: Re: Turing Assistance

Ok thanks.... So basically to finish my game off, I want to make levels. Easy,Medium and hard. How do i do it so that it goes to a main menu and they select the difficulty and it takes them to that? How do I do a main screen?

Also, How do i guarantee the spaces are enough for the ball?
Raknarg




PostPosted: Sun May 26, 2013 9:00 pm   Post subject: RE:Turing Assistance

Think about it logically. What factors change how difficult this game is? Is there something you can use to keep track of it, an integer perhaps?

Also think of the menu screen. What goes on a menu screen?

For your spaces, make the minimum the radius of the ball. If the ball is 10 pixels acros, the space can't be less than ten pixels.
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  [ 13 Posts ]
Jump to:   


Style:  
Search: