Computer Science Canada

Soccer Game

Author:  yumrum [ Fri Dec 18, 2009 4:22 pm ]
Post subject:  Soccer Game

-Soccer Game
- controls are arrow keys and a/w/s/d
to switch it's 1/2/3/4 and 7/8/9/0

have fun

and critizime is wanted

Author:  Tony [ Fri Dec 18, 2009 5:10 pm ]
Post subject:  RE:Soccer Game

I love the driver loop at the very end of the code, well done Smile

Now then...
code:

var playerwho, playerwho1 : int := 1

What is playerwho1 and how is it different from.... not 1. Bad variable name.

code:

var collision1 : boolean
var collision2 : boolean
...

arrays! You are using them else where. In fact
code:

var x : array 1 .. 9 of int % For all player's and Bal
var y : array 1 .. 9 of int

Here they are. Though those are parallel arrays, which are not always ideal. Perhaps use types/records.

You have multiple Input.KeyDown reads in a single frame.

code:

if playerwho = 1 then
        Input.KeyDown (chars) % Value for key
        if chars (KEY_UP_ARROW) then
            y (1) := y (1) + 5
        end if
        if chars (KEY_RIGHT_ARROW) then
            x (1) := x (1) + 5
        end if
        if chars (KEY_LEFT_ARROW) then
            x (1) := x (1) - 5
        end if
        if chars (KEY_DOWN_ARROW) then
            y (1) := y (1) - 5
        end if

        % Goalie
    elsif playerwho = 2 then
        if chars (KEY_UP_ARROW) then
            y (2) := y (2) + 5

You are duplicating the same chunk of code 9 times.
code:

if chars (KEY_UP_ARROW) then
            y (playerwho) := y (playerwho) + 5
...

Also, +5 (and -5) are a magic constant. Should make it a constant instead, so that one could actually adjust the velocity of the players in the code.

Having 8 identical "Collided" functions repeats a lot of code. Just take an argument for which players to check.

"procedure sides" is also full of repetition.

code:

if score1 = 0 then
        Draw.Text ("0", 50, 600, font4, black)

or
code:

Draw.Text(intstr(score1), 50, 600, font4, black)


code:

cls
        Draw.Text ("5", 240, 200, font4, black)
        View.Update
        delay (1000)
        cls
        Draw.Text ("4", 240, 200, font4, black)
        View.Update
        delay (1000)
        cls
...

For-loops?
code:

% player starting positions
        x (1) := 560
        y (1) := 300

I think I saw a procedure to reset the positions... is that not used?

code:

    if x (9) < 10 and y (9) < 360 and y (9) > 240 then
        cls
        % Setting Screen size
        setscreen ("graphics:500;400,offscreenonly")
        put " PLAYER TWO GOAL GOAL GOAL"
        score2 := score2 + 1

        %Counting down
        Draw.Text ("Ready", 240, 200, font4, black)
...

You are repeating this huge chunk of code (count down, reset, etc.), twice, for each player scoring a goal, even though the code is completely identical.

Author:  yumrum [ Fri Dec 18, 2009 10:05 pm ]
Post subject:  Re: Soccer Game

Thanks for all the critizime and help and tips
they help LOADS i was able to cut the amout of code i used in half now.
Gonna add some new features and stuff before i post the new version tho

Author:  mirhagk [ Sat Dec 19, 2009 10:54 am ]
Post subject:  RE:Soccer Game

Also maybe you should add a button to kick the ball, just a suggestion

Author:  yumrum [ Sat Dec 19, 2009 5:31 pm ]
Post subject:  Re: Soccer Game

Ya i'm working on adding a pass button and a shoot button
as well as a goalie drop kick.
as well i'm going to add a start menu with team choice/ time limit and handicap setting for speed
Also have to fix the problem of running threw the goalie but i can't seem to get that working Any suggestions?

Author:  yumrum [ Sat Dec 19, 2009 9:04 pm ]
Post subject:  Re: Soccer Game

Here's The Updated Version 2.0

The Changes
-added speed handicap adjust in program
-added a Time limit adjust in program
-added a start up
-added a pass button and shot Button
-Code cut in about Half

Still to Come
-Fix the go through players problem- Not sure how to solve- suggestions are needed, I've tried a bunch
-Change Colours/team option in start up (these will be like world cup teams-Brazil, Italy, but also Canada)
-Start up switched to buttons on one screen instead of multiple screens with typed entries
-1 player game/ with computer controlled players
-shootout mode at the end if a tie
-and anything else people want (suggestions)

Controls are
-to move arrow keys and a/w/s/d
-player 1 pass (,) up and (.) down and (/) to kick
-player 2 pass (q) up and (e) down and (r) to kick

Author:  yumrum [ Sun Dec 20, 2009 9:10 pm ]
Post subject:  Re: Soccer Game

So here's Soccer 3.0
some stuff to come same as before

Author:  Turing_Gamer [ Wed Dec 23, 2009 8:52 pm ]
Post subject:  Re: Soccer Game

A little rough but other wise a good game

Maybe for extra features you can have advanced controls like hold 'j' to dribble the ball and 'g' to steal

Otherwise, not bad.

Author:  yumrum [ Wed Dec 23, 2009 11:07 pm ]
Post subject:  RE:Soccer Game

Alright i'll think of those things
-I just finishing touching up v4.0 which completely changes it

- it's got a new startup thats more user friendly
-choice of 6 different countries (teams)
-fixed the running throught problem
-players following the controled player around
-goalie can kick it forward a lot farthe

so ya v4 is gonna be sick

also u do know that dribble is just pushing the ball?
and stealling would be pushing it off the other person and then above?

Author:  i'm not sure [ Thu Dec 24, 2009 11:16 am ]
Post subject:  Re: Soccer Game

I like it espectially the way that you carry the ball i think it's really unique. The one thing you really need though is a way to switch you player and a way of identifying which one's are being controlled by humans, otherwise good game.

Author:  yumrum [ Thu Dec 24, 2009 12:36 pm ]
Post subject:  RE:Soccer Game

you can switch your player it's... say ur player 1 then it,s 7/8/9/0 for each player corrisponding with the number for each player and it's 1,2,3,4 for player 2 corrisponding with each number

Author:  yumrum [ Thu Dec 24, 2009 12:45 pm ]
Post subject:  Soccer Game

Here is
Soccer v4.0
New
-New Startup with buttons
-goalie dropkick (just normal kick but with goalie it goes alot farther)
-choice of 6 teams instead of 2 default
-controls in game
-couple of pics to spice it up
-people follow controlled player
-fixed runthrough problem

check the ReadMe file for more in depth info

This one has some major changes

Author:  i'm not sure [ Thu Dec 24, 2009 3:16 pm ]
Post subject:  RE:Soccer Game

Sorry about that, didn't know those controls but it makes it a very good game!

Author:  yumrum [ Thu Dec 24, 2009 3:30 pm ]
Post subject:  RE:Soccer Game

ya i didn't have any control listed bu in v4 we do i listed


: