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

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




PostPosted: Fri Mar 19, 2004 10:36 am   Post subject: shooting problem

Hey sup ppl! I have to make a game for my final ISP. I am almost done the program. But when my plane shoots the bomb, it gets so many errors there. I want to have the plane shooting more than 1 bomb. Can some one please help me???? The problem with my plane is that it shoots only one bomb at a time and shoot another after the first bomb has gone off the screen.
Sponsor
Sponsor
Sponsor
sponsor
poly




PostPosted: Fri Mar 19, 2004 10:57 am   Post subject: (No subject)

could you please post your code, this way it will be much easier to help/guide you to the right path
jonos




PostPosted: Fri Mar 19, 2004 11:02 am   Post subject: (No subject)

first of all, make sure you are using loops and not processes, that may just be your problem, secondly: yes, please post your code, or your .t file, or a zip file with all the images, and lastly: i think dan shadow wrote a tutorial shwoing how to make more than one bomb drop.

a way you could do yours is: when the user presses a button, drop the bomb (a decreasing y value for the bomb), keep checking in the loop to where you want the bomb to go to before you can drop another bomb:

something like:
code:

if bomby <= 500 then
allow dropping of a nother bomb
end if


something like that, but you will have to do some stuff before that to make sure a bomb was even dropped! have fn.
Tendulkar




PostPosted: Fri Mar 19, 2004 11:18 am   Post subject: (No subject)

process shoot_bomb
setscreen ("nooffscreenonly")
for i : y + Pic.Height (plane1) .. maxy + 100
Pic.Draw (bomb1, shoot_x (val), i, picMerge)
View.Update
Pic.Draw (bomb_bg, shoot_x (val) - 5, i - 5, picMerge)
Pic.Draw (plane1, x, y, picMerge)
bomb_1_x (val) := x
bomb_1_y (val) := i
exit when bomb_1_x (val) >= enemy_plane1_x and bomb_1_x (val) <= enemy_plane1_x + Pic.Width (enemy_plane1) and bomb_1_y (val) >= enemy_plane1_y and bomb_1_y (val) <=
enemy_plane1_y + Pic.Height (enemy_plane1)
exit when bomb_1_x (val) >= enemy_plane2_x and bomb_1_x (val) <= enemy_plane2_x + Pic.Width (enemy_plane2) and bomb_1_y (val) >= enemy_plane2_y and bomb_1_y (val) <=
enemy_plane2_y + Pic.Height (enemy_plane2)
exit when bomb_1_x (val) >= enemy_plane3_x and bomb_1_x (val) <= enemy_plane3_x + Pic.Width (enemy_plane3) and bomb_1_y (val) >= enemy_plane3_y and bomb_1_y (val) <=
enemy_plane3_y + Pic.Height (enemy_plane3)
Pic.Draw (bomb_bg, shoot_x (val) - 5, i - 5, picMerge)
end for
end shoot_bomb




OK! the problem is when you shoot the bomb towards enemy planes, the x position of the bomb is also the x position of your plane. so when u move the plane, the bomb also moves, instead of going straight.
recneps




PostPosted: Fri Mar 19, 2004 11:22 am   Post subject: (No subject)

give the bomb separate values, like
bombx:=planex
bomby:=planey
to startm then have its y value drop, and x value stay the same (i assume its not like missile? its just droppping?)
jonos




PostPosted: Fri Mar 19, 2004 11:45 am   Post subject: (No subject)

aaaaahhhh, you're using processes, that may just be your problem. try to put everything in one loop (it can be done), you should only use processes for music.

attach the whole thing including the pictures in a zip file and upload to here, then we will better be able to see it.

anywyas, just do what recneps said about the bomb, make two variable for the bomb and then at the shooting action get the bomb vars (x/y) to equal those of the planes, and then use the bomb variables to move the bomb.
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  [ 6 Posts ]
Jump to:   


Style:  
Search: