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! / Shooting all around

Author
Message
Fa1con
16
Years of Service
User Offline
Joined: 20th Aug 2007
Location:
Posted: 28th Oct 2007 05:55
iw as just wondering about shooting

i was wodnering how would i make it shoot all around because i rotate my sprite all around

how would i make my bullet(sprite 2) shoot whatever way im facing

any help is great, thanks,
Fa1con
16
Years of Service
User Offline
Joined: 20th Aug 2007
Location:
Posted: 28th Oct 2007 06:06
oh yes i didnt want to make a new thread so ill post my second question here

i know how to make it when i press a key it will scroll
my question is how do i get the background to scroll is #1 and #2 is my sprites rotates 360 how do i get the background to scroll whatever way he is facing
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 28th Oct 2007 15:23
for your first question, do something ALONG the lines of

if spacekey()=1
sprite shot,sprite x(1),sprite y(1),shotimage
offset sprite shot,sprite width(shot)/2,sprite height(shot)/2
rotate sprite shot,sprite angle(1)
endif

if sprite exist(shot)
move sprite shot,1
endif

and your second question, i dont fully understand... so you mean, you want like a diablo type of game? from what i can understand, you would make your background sprite number somethings, and do this

sprite 2,0,0,mapnum
do
rotate sprite 2,sprite angle(1)
move sprite 2,-1
loop


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroupproductions.com/
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 28th Oct 2007 22:03 Edited at: 28th Oct 2007 22:06
hmm, not sure if i still understand. does he want something like in diablo were the character is always in the middle of the screen, and then when the player wants to move, the game.. wait, i get it.. check this.......




what that code does is
1- sets up a map image
2-sets up a player image
3-offsets the map and player
4-allows player to rotate right or left
5-keeps player in the middle of the screen
6-player doesnt move, the map rotates to the players angle, moves back 1 unit, and then before the screen is refreshed, rotates back to normal, making it appear like its scrolling.


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroupproductions.com/
Fa1con
16
Years of Service
User Offline
Joined: 20th Aug 2007
Location:
Posted: 28th Oct 2007 22:29
OHHHH! thank you soo much that helped a lot and did exactly what i wanted
Fa1con
16
Years of Service
User Offline
Joined: 20th Aug 2007
Location:
Posted: 28th Oct 2007 22:35
one quick questiona bout the shooting code though. it works except all it does is lock the sprite with my other sprite so when i roatet my sprite, the bullet is like a part of the sprite and rotates with it.
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 28th Oct 2007 22:41 Edited at: 28th Oct 2007 22:47
wait, the shot rotates with the player? try changing the sprite numbers.


theres a modfiied code of the code i had previously...
there will only be able to be 1 shot at atime because the shot will always be sprite number 3.
see if you can overcome that problem by yourself


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroupproductions.com/
Fa1con
16
Years of Service
User Offline
Joined: 20th Aug 2007
Location:
Posted: 28th Oct 2007 22:55
i almost have it, now when i shoot the bullet i can control the bullet lol
Fa1con
16
Years of Service
User Offline
Joined: 20th Aug 2007
Location:
Posted: 28th Oct 2007 23:19
okay so i have it except for one problem, the bullet doesnt line up wih my turret(sprite 1) when i rotate my turret it rotates the bullet but not in the same direction. and also when i kill the guys im shooting at i use hide sprite that clears them but they are still there and when my bullet hits them it gives me a highser score and the bullet disapears, i tried but that didnt work
Fa1con
16
Years of Service
User Offline
Joined: 20th Aug 2007
Location:
Posted: 28th Oct 2007 23:21
SPRITE 10 = Bullet
SPRITE 5 = enemy
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 28th Oct 2007 23:23
instead of using 'hide sprite' try deleteing them, or repotioning them to start locations.


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroupproductions.com/
Fa1con
16
Years of Service
User Offline
Joined: 20th Aug 2007
Location:
Posted: 29th Oct 2007 01:29
k repositiioning would work but only thing ic an think of is OFFSET SPRITE? is that right? i tried it but it didnt work
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 29th Oct 2007 01:49
hmm, no...
when you have a sprite with no offset, it rotates around 1 point of the image. the point is the top left most pixel of the image by defualt. the offset sprite command s used to change witch pixel that is.

to reposition a sprite, simply call the sprite command again. for example...

sprite player,x,y,imagenumber
do
if sprite hit(player,shot)
sprite player,respawnx,respawny,imagenumber
delete sprite shot
endif
loop


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroupproductions.com/
Fa1con
16
Years of Service
User Offline
Joined: 20th Aug 2007
Location:
Posted: 29th Oct 2007 01:52
OH! thank you so much for all the help
flashing snall
18
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 29th Oct 2007 02:43
no problemo. look foward to seeing what you made.


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroupproductions.com/

Login to post a reply

Server time is: 2024-05-18 10:08:50
Your offset time is: 2024-05-18 10:08:50