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

Username:   Password: 
 RegisterRegister   
 my school project, come in and help me out
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
BPhelmet




PostPosted: Mon Dec 20, 2004 9:42 pm   Post subject: my school project, come in and help me out

this is my program, it is big because of the map.

it is a fighter plane game, my problem is i don't know how to make the plane shoot mutiple bullets and moving while shooting.

can anyone help me out?


Why can't i upload stuff???[/b]
Sponsor
Sponsor
Sponsor
sponsor
BPhelmet




PostPosted: Mon Dec 20, 2004 9:45 pm   Post subject: (No subject)

it says "Upload Error: Could not upload Attachment to ./../bbs/files/ace.zip."

what can i do?
Tony




PostPosted: Tue Dec 21, 2004 11:43 am   Post subject: (No subject)

how big is the file in size? that could be an issue..

as to shooting and movement: you got to make your spaceship and missiles separate objects, independant of each other. This way during each loop pass, you can move one, then the other.

keep in mind that you move each by 1 unit. You do not have an internal loop dedicated to just one object.
BPhelmet




PostPosted: Tue Dec 21, 2004 12:18 pm   Post subject: (No subject)

it is only 2.5MB

here's how i did it

code:
setscreen ("offscreenonly")
setscreen ("nocursor")
setscreen ("graphics:vga")

%variable for background, the plane and the bullet
var background, realP_51, bullet : int

%give backfround a value
background := Pic.FileNew ("level1background.jpg")

%give the plane a value
realP_51 := Pic.FileNew ("P-51D.bmp")

%give bullet a value
bullet := Pic.FileNew ("bullet.jpg")

%variable for the control of the plane
var move : string (1)

%variable for bullets to move
var xb1, yb1, xb2, yb2 : int


%variables for the background to move
var x2, y2 : int
x2 := 150
y2 := 0

%variables for P-51D to move
var x1Mustang, x2Mustang, y1Mustang, y2Mustang : int
x1Mustang := 400
x2Mustang := 480
y1Mustang := 0
y2Mustang := 80

%variables for enemy planes
%set how many plane will there be
var EnemyPlaneCounter := 80             %the number will start at 80 and will increase by level

%setting up the picture
var EnemyPlane : int

EnemyPlane := Pic.FileNew ("Me-109.bmp")

%loop so the back ground moves
for i : 1 .. 2633

    %x's and y's for enemy plane
    var EnemyPlaneX, EnemyPlaneY : array 1 .. EnemyPlaneCounter of int

    %to see if the plane is alive
    var EnemyPlaneAlive : array 1 .. EnemyPlaneCounter of boolean

    %initialize the enemy planes
    for a : 1 .. EnemyPlaneCounter
        randint (EnemyPlaneX (a), 150, 850)
        randint (EnemyPlaneY (a), 700, 1000)
        Pic.Draw (EnemyPlane, EnemyPlaneX (a), EnemyPlaneY (a), picMerge)
        EnemyPlaneX (a) := EnemyPlaneX (a)
        EnemyPlaneY (a) := EnemyPlaneY (a) - 10
    end for
    %variable to keep track fo the score
    var score : int := 0

    %variable to keep track of player's health
    var health : int := 200

    cls
    drawfillbox (0, 0, maxx, maxy, black)
    Pic.Draw (background, x2, y2, picMerge)
    Pic.Draw (realP_51, x1Mustang, y1Mustang, picMerge)

    y2 := y2 - 3
   
    %counter for bullets
    var bulletCounter := 1

    xb1  := x1Mustang + 30
    yb1  := y1Mustang + 60
    xb2  := x1Mustang + 48
    yb2  := y1Mustang + 60

    View.Update

    if hasch then
        getch (move)
        case move of
            label chr (200) :
                y1Mustang := y1Mustang + 15
                if y1Mustang > 620 then
                    y1Mustang := 620
                end if
            label chr (208) :
                y1Mustang := y1Mustang - 15
                if y1Mustang < 0 then
                    y1Mustang := 0
                end if
            label chr (205) :
                x1Mustang := x1Mustang + 35
                if x1Mustang > 770 then
                    x1Mustang := 770
                end if
            label chr (203) :
                x1Mustang := x1Mustang - 35
                if x1Mustang < 150 then
                    x1Mustang := 150
                end if
            label chr (32) :
                fork fireP_51D
                for a : 1 .. 15
                    Pic.Draw (background, x2, y2, picMerge)
                    Pic.Draw (realP_51, x1Mustang, y1Mustang, picMerge)
                    y2 := y2 - 3
                    yb1  := yb1  + 50
                    yb2  := yb2  + 50
                    Pic.Draw (bullet, xb1 , yb1 , picCopy)
                    Pic.Draw (bullet, xb2 , yb2 , picCopy)
                    View.Update
                end for
                Music.PlayFileStop
            label "q" :
                ex2 := true
                Window.Close (winID)
            label :
        end case
    end if
end for
BPhelmet




PostPosted: Tue Dec 21, 2004 12:20 pm   Post subject: (No subject)

that is only part of the program

my friend is on his way to send the whole pakage
Yenan




PostPosted: Tue Dec 21, 2004 12:27 pm   Post subject: (No subject)

Here's the background


level1background.jpg
 Description:
 Filesize:  1.81 MB
 Viewed:  3294 Time(s)

level1background.jpg


BPhelmet




PostPosted: Tue Dec 21, 2004 12:28 pm   Post subject: (No subject)

and you can ignore the enemy plane part, i haven't got that far yet.

well, i still have problem getting the computer to draw the enemy planes
BPhelmet




PostPosted: Tue Dec 21, 2004 12:48 pm   Post subject: (No subject)

there it is


ACE.zip
 Description:
program

Download
 Filename:  ACE.zip
 Filesize:  610.87 KB
 Downloaded:  127 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Tue Dec 21, 2004 3:09 pm   Post subject: (No subject)

You have an upload capacity of 2.0mb, which is why you couldn't upload it.

As to your question:
Read up on Flexible Arrays. They will allow you to create an object (a bullet) whenever you hit the fire button on the keyboard. You can keep track of various aspects of that object (the bullet) as the rest of the program is running. Don't skip over the dueling game at the end of the first post, it's pretty much exactly what you are looking for.
BPhelmet




PostPosted: Tue Dec 21, 2004 7:28 pm   Post subject: (No subject)

thanx
BPhelmet




PostPosted: Tue Dec 21, 2004 9:16 pm   Post subject: (No subject)

Cervantes wrote:
You have an upload capacity of 2.0mb, which is why you couldn't upload it.

As to your question:
Read up on Flexible Arrays. They will allow you to create an object (a bullet) whenever you hit the fire button on the keyboard. You can keep track of various aspects of that object (the bullet) as the rest of the program is running. Don't skip over the dueling game at the end of the first post, it's pretty much exactly what you are looking for.


i don't quite understand you program, is it possible to just put all the couunting and drawing together, is there any other way to do this exept yours.
Cervantes




PostPosted: Tue Dec 21, 2004 9:36 pm   Post subject: (No subject)

BPhelmet wrote:

i don't quite understand you program, is it possible to just put all the couunting and drawing together, is there any other way to do this exept yours.

what do you mean, the counting and drawing? I think I put all the drawing at the end, and everything else (input and manipulation) before it.

You could use processes. But, no. Do not do that. This is the best way to do it. Trust me.
BPhelmet




PostPosted: Tue Dec 21, 2004 10:06 pm   Post subject: (No subject)

what's that += suppose to mean?
BPhelmet




PostPosted: Tue Dec 21, 2004 10:11 pm   Post subject: (No subject)

o man,

i still don't get it, can you just download my program and help me fix it?

please
Neo




PostPosted: Tue Dec 21, 2004 10:15 pm   Post subject: (No subject)

BPhelmet wrote:
what's that += suppose to mean?


+= means to increment. Like x+=1, increases x by 1, same as x:=x+1 but shorter.
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 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: