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! / Enemy Sprite movement problems

Author
Message
Davecgt
21
Years of Service
User Offline
Joined: 6th Feb 2004
Location:
Posted: 17th Mar 2004 16:47
Hey All,

I'm still on with my Zelda clone; it's comming along nicely but i'm having a major problem with the enemy sprites. I can't seem to get the enemy sprite to remain independent of the game view window.

eg. When i move the main character the enemy sprite is dragged along with the screen instead of staying in its relative position in the game world - am i missing something really simple or what?
Are there any clever bods out there who can see what i'm doing wrong?

Cheers all,
Dave.
DivW
22
Years of Service
User Offline
Joined: 31st Jul 2003
Location: Scotland
Posted: 31st Mar 2004 17:08 Edited at: 31st Mar 2004 17:09
I guess things get complicated here. What you need to do is decrease the X position of the baddies as the X position of the player increases. example: You move up by 2 squares, so the baddie moves down (towards, or away, from you). Decrease the baddie's X position with the background. I had a look at your code, but there aren't enough REM's in there for me to get what's going on. This sort of thing's a pain in the ass-use functions and subroutines to sort your code out.

-Dave

Your soul...it tastes like chicken

Official Website Postponed
glint
21
Years of Service
User Offline
Joined: 9th Feb 2004
Location: the Synth
Posted: 2nd Apr 2004 04:16
Note, if you are going to make large Zelda levels, you do not want to have to maintain offscreen enemy sprites. Simply store the enemies in a virtual array with world locations that are not relative to your position. Also, give the center of your screen a world coordinate. In the step event, check where these points are in relation to eachother and paste enemy sprites where they would be if they were onscreen. When they go offscreen, delete them.

Login to post a reply

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