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

Username:   Password: 
 RegisterRegister   
 Space Shooter help please!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
zain




PostPosted: Thu Jan 07, 2010 12:04 pm   Post subject: Space Shooter help please!!

Hi, i Hav programed this game so far for my grade 11 final progrct but i am stuck now and need some help making the bullters shoot from the player's space shuttle. You can check out the game that i made so far by downloading the attachments, again it's mot finished.

So, the problem is that i want the player to shoot the bullets when he presses a button on the keyboard, as u can see in the code that i tried doing that and it doesn't work, After making the bullets shoot from the players shuttle I want it to hit the gray shuttles (The Enemy) Once it hit's the gray shuttle the want the bullet to disappear first then the Gray shuttle clearing off the screen, so i suppose that i hav to do some kind of collision detection. if possible i want thte gray shuttle to be replaced by a picture of explosion after the bullets hav hit it many times and then make the explosion go off the screen after some delay.

Please help me with this i am stuck and can't seen to figure out how to do this, this is my final sumative for grade 11 class. Oh i don't want the gray shuttle to disappear in one bullet. I guess i am trying to make something like space shuttles game.

ANy help will be greatly appreciated, the files are attached and make sure everything after extracted is in the same directory.

Thanks in advance,

Zain



enemy.JPG
 Description:
enemy
 Filesize:  1.65 KB
 Viewed:  1634 Time(s)

enemy.JPG



shuttle copy.png
 Description:
 Filesize:  6.18 KB
 Viewed:  1634 Time(s)

shuttle copy.png



shooter.t
 Description:
main game

Download
 Filename:  shooter.t
 Filesize:  1.48 KB
 Downloaded:  95 Time(s)


shooter.t
 Description:

Download
 Filename:  shooter.t
 Filesize:  1.48 KB
 Downloaded:  82 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
SNIPERDUDE




PostPosted: Thu Jan 07, 2010 9:50 pm   Post subject: RE:Space Shooter help please!!

Keeping all your files in a RAR or ZIP file will help make posting easier.

What you need to do is just sit down and think of the logistics of how you can achieve you goal before you start hacking at code. Pen and paper is one of if not the best programming practices.

So I'll help you out getting started. What is the path of the bullet?
- When you press the fire key, the bullet starts at the players location, and is activated
- Each loop the bullet moves from its initiated location forward in a predetermined velocity.
- When the bullet reaches something (a wall, enemy, etc), the bullet is deactivated (a boolean value determining whether the bullet is "alive" or not).

You would also very likely need some form of control so that holding down the key won't make it stick to the player. So an if statement checking whether the bullet is already activated or not would make sense.

Good luck, I've given you plenty of clues to help you out. For collision detection, look into the whatdotcolour tutorial in the Turing Walkthrough.
zain




PostPosted: Thu Jan 07, 2010 10:05 pm   Post subject: RE:Space Shooter help please!!

Please help me with the code i am new and this is my first time programming, i want the player to hit the Alt key and the player's chracter in the game will shoot and when the bullets hits it i want it and the enemy to disappear, i hav no idea how to code this.
registration




PostPosted: Thu Jan 07, 2010 10:23 pm   Post subject: Re: RE:Space Shooter help please!!

zain @ Thu Jan 07, 2010 10:05 pm wrote:
Please help me with the code i am new and this is my first time programming, i want the player to hit the Alt key and the player's chracter in the game will shoot and when the bullets hits it i want it and the enemy to disappear, i hav no idea how to code this.

Use chr := getchar and if the variable is equal to ARROW_LEFT (or something along those lines, look it up) then use your procedure for your bullet. Then use your collision detecting procedure to see if it hits the enemy, and if it does, sprite.hide the enemy. (or if you're using pics, just draw over it..)
SNIPERDUDE




PostPosted: Fri Jan 08, 2010 8:02 pm   Post subject: RE:Space Shooter help please!!

We will not do the coding for you (as it is your schoolwork), but we can help you out where we can. One of the best approaches I learned when I was taking Turing was when I figured out what I wanted to do, I looked through the titles in the Turing Walkthrough (<- CLICK) to see how exactly to code it. Just give it a try, I guarantee it works.

If you have any specific questions regarding your coding (ex: "This doesn't look right", "is there a better approach to doing this?", "why does this keep doing X instead of Y?", etc) then we can be of more help and hands-on.
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  [ 5 Posts ]
Jump to:   


Style:  
Search: