+frankodragon Posted July 24, 2014 Share Posted July 24, 2014 Using AM's Zelda demo engine I've been designing my own using different sprites, etc, and I'm clueless as to how to move an enemy within a "room." Plus, as your character shoots an enemy, then it should disappear but it just regenerates. I'll admit I'm still a noob when it comes to programming the 7800: plotsprite snake_b 2 snake_b_x snake_b_y if room>24 && room<36 then plotsprite snake_b 2 snake_b_x snake_b_y if xfire>snake_b_x && xfire<(snake_b_x+16) && yfire>snake_b_y && yfire<(snake_b_y+16) then snake_b_y=200 if snake_b_x=45 then snake_b_x=65 if snake_b_y=55 then snake_b_y=75 if snake_b_x=64 then snake_b_x=45 if snake_b_y=75 then snake_b_y=55 snake_a_x=snake_a_x+1 snake_a_y=snake_a_y+1 snake_b_x=snake_b_x+1 snake_b_y=snake_b_y+1 snake_a_x=snake_b_x snake_a_y=snake_b_y A snake is in a room so I've tried to make it move but it won't stay within the room. It'll move out of the room, then reappear. If you go to the next room it'll do the same thing. Then if you kill it with the code above (I even tried it with boxcollision with same results) it just regenerates or just stays there. I think each room does have the same X/Y coordinates so if you send the snake to y=200 (off the screen) it will just reappear again. Is there some sort of "dumping ground" to which you can send the enemies to without having them to regenerate or some sort of timer that will keep them from regenerating? test4.bas Quote Link to comment Share on other sites More sharing options...
RevEng Posted July 25, 2014 Share Posted July 25, 2014 Its "regenerating" because you're still moving it, and it eventually moves back on-screen. You just need to stop moving or plotting the snake if y=200. e.g... if snake_b_y=200 then goto SkipSnakeDisplay if xfire>snake_b_x && xfire<(snake_b_x+16) && yfire>snake_b_y && yfire<(snake_b_y+16) then snake_b_y=200:goto SkipSnakeDisplay if room>24 && room<36 && then plotsprite snake_b 2 snake_b_x snake_b_y if snake_b_x=45 then snake_b_x=65 if snake_b_y=55 then snake_b_y=75 if snake_b_x=64 then snake_b_x=45 if snake_b_y=75 then snake_b_y=55 snake_a_x=snake_a_x+1 snake_a_y=snake_a_y+1 snake_b_x=snake_b_x+1 snake_b_y=snake_b_y+1 snake_a_x=snake_b_x snake_a_y=snake_b_y SkipSnakeDisplay Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.