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! / Pointing Sprites?

Author
Message
Zero Blitzt
21
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 9th Apr 2004 08:08
Someone gave me the idea for a Robotron remake*, so I want to know if there is a way to point a sprite towards another sprite. There is no "point sprite" command, so does anyone know how this can be done? This way I can start coding tomorrow morning when I wake up... I'm real sleepy now.

*Someone on these boards gave me the idea, sorry for stealing it...

Good night!

http://www.t4e0.4cybiko.com- GameXaero Forums
http://www.t4e0.4cybiko.com/gxstudios - GX Studios
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 9th Apr 2004 14:50
ATANFULL is what you need. Try this:



Boo!
Zero Blitzt
21
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 10th Apr 2004 18:07 Edited at: 11th Apr 2004 03:14
Sorry for double post (this one and the one below...)

http://www.t4e0.4cybiko.com- GameXaero Forums
http://www.t4e0.4cybiko.com/gxstudios - GX Studios
Zero Blitzt
21
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 11th Apr 2004 00:35
Can Anyone tell me why the enemy wont move at all in the attached code?

Thanks, and thanks to spooky.

http://www.t4e0.4cybiko.com- GameXaero Forums
http://www.t4e0.4cybiko.com/gxstudios - GX Studios
Zero Blitzt
21
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 11th Apr 2004 00:36
Can anyone tell me why the enemy sprite wont move at all? It rotates...

http://www.t4e0.4cybiko.com- GameXaero Forums
http://www.t4e0.4cybiko.com/gxstudios - GX Studios
Zero Blitzt
21
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 11th Apr 2004 03:46
The ATANFULL is definitely not working. I did get it to point at the main character's sprite, but when the main's sprite moved, the enemy did not rotate quickly enough.

Please help, my source is attached above, I have a big headache.

http://www.t4e0.4cybiko.com- GameXaero Forums
http://www.t4e0.4cybiko.com/gxstudios - GX Studios
guru of boredom
21
Years of Service
User Offline
Joined: 12th Oct 2003
Location: middle of no where
Posted: 12th Apr 2004 06:35
u need the distance from the pointing sprite to the target sprite.

xdist=pointerx-targetx
ydist=pointery-targety
ang=atanfull(xdist,ydist)

if that dosent work switch the order of pointer and target

we are not outnumbered! we are just in a target rich enviroment!
P4 2.4 ghz 120 GB 256 mb GeForce4
Code Stealer
21
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 12th Apr 2004 18:11
Try this source, its a homing missile code using trig and ATAN.You will have to make a pointer image called arrow.bmp

BTW, what is ATANFULL?

GIve me more power!
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 13th Apr 2004 02:51
The other problem is this line:

sprite robo1,enemyx#,enemyy#,robo1

as enemyx# and enemyy# naever change in program you are constantly repositioning sprite at same position every loop.

Move this line outside of main loop.

Boo!
Zero Blitzt
21
Years of Service
User Offline
Joined: 18th Jan 2004
Location: Different Stages
Posted: 14th Apr 2004 00:48
Thank you so much everyone for all of your help. This is why I love DarkBasic! I've had it for 3 months, I'm a ½ newb, yet people still help me without flaming me.

You can expect to see this game soon, I'm not gonna abandon it like my other game...

http://www.t4e0.4cybiko.com- GameXaero Forums
http://www.t4e0.4cybiko.com/gxstudios - GX Studios

Login to post a reply

Server time is: 2025-08-09 02:12:51
Your offset time is: 2025-08-09 02:12:51