Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / Can't get bullet to fire in front of Sprite

Author
Message
zDough BoyZ
16
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 2nd Jun 2007 01:54 Edited at: 2nd Jun 2007 06:05
When i press the fire key my bullet just appears above my sprite no matter what direction it is facing. I though i had the right code in but something is not right. Can some look it over to see if there is something noticeable.



mod edit [indi] your code tags were back to front [ / c o d e ] your [ c o d e ]
this is correct without spaces [ c o d e ] yourcode [ /c o d e ]
the code button will make life easier if you forget.

The Internet Is TUBES
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 2nd Jun 2007 06:09
looking briefly your rotating the player with the a variable.
but the bullet with y# and that doesnt link to anything i can see look briefly.

zDough BoyZ
16
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 2nd Jun 2007 06:39
I tried changing the y# thing to several different things but it still changes nothing. I just can find what i need to add or change. Thanks for taking the time to look.

The Internet Is TUBES
zDough BoyZ
16
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 2nd Jun 2007 21:16
I still don't understand what to do with my code. In what way do i change "sprite 2, sprite x(1), sprite y(1), 2"

The Internet Is TUBES
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 4th Jun 2007 00:08
zDough,

As you rotate the ship, it will make a difference where the bullet (sprite 2) comes out. You must adjust it's position based upon the current angle of the ship. If your ship is facing right, for example, you would adjust the x position of sprite 2 to be at the right side of the ship and the y coordinate would need to be adjusted so it appears to come out of your ship's cannon (or whatever you have used). Example: sprite 2,sprite x(playersprite)+(sprite width(playersprite)/2),sprite y(playersprite)+20,2

The y# variable will not help with the positioning of sprite 2. However, if you use anything other than a dot for the shot, you would want the angle to be changed to correspond with the ship once again. You wouldn't want a shot that points straight up to come out of the right side of the ship, it wouldn't look realistic.

LB
zDough BoyZ
16
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 4th Jun 2007 00:50
i see... i think my code is a little messed up so im going to try and rewrite and use your info.

The Internet Is TUBES
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 4th Jun 2007 01:40
Okay. If at some point you need more help, please post the media so we know what you are looking at.

LB
zDough BoyZ
16
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 21st Jun 2007 19:07 Edited at: 21st Jun 2007 19:09
ok... im not sure if anyone is still looking at this (I went on vacation and didnt get to post) but here is the media of it. The bullet still just fires above the ship. I tried using your advise and just can get it to work. That for the help and the time.



The Internet Is TUBES

Attachments

Login to view attachments
zDough BoyZ
16
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 21st Jun 2007 19:10 Edited at: 21st Jun 2007 19:11
Here is the other file. I was have trouble using the file uploader.
You can just delete the two music lines

The Internet Is TUBES

Attachments

Login to view attachments
zDough BoyZ
16
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 21st Jun 2007 23:31
Oh thank you so much... i am retarded. I realized now you really just need to think logically witch i dont do. Thanks for the help.

The Internet Is TUBES
zDough BoyZ
16
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 22nd Jun 2007 00:41 Edited at: 22nd Jun 2007 00:42
now sorry to keep asking and asking but why can i only fire one bullet and not keep pressing space bar for more. I have read about arrays but im not sure if that is was i need to add for mine. Just a little clarification please.

The Internet Is TUBES
BiggAdd
Retired Moderator
19
Years of Service
User Offline
Joined: 6th Aug 2004
Location: != null
Posted: 8th Jul 2007 03:57
I made this ages ago. My coding is probably rubbish, but it might be at least a start to what your looking for:

Simple 2D Shooting Tutorial

zDough BoyZ
16
Years of Service
User Offline
Joined: 30th May 2007
Location:
Posted: 17th Jul 2007 06:06
thanks for the tutorial im using it right now
its really well set up

The Internet Is TUBES
BiggAdd
Retired Moderator
19
Years of Service
User Offline
Joined: 6th Aug 2004
Location: != null
Posted: 19th Jul 2007 00:21
No problem. Hope it helps.

Login to post a reply

Server time is: 2024-05-27 16:41:47
Your offset time is: 2024-05-27 16:41:47