Post by memorydump on Jan 20, 2011 23:16:35 GMT -5
I'm never going to be an excellent coder, but am trying what I can. I recently thought I could try to make a Zelda engine by just taking examples that have been given already and try to edit them and hopefully get my desired result. That's basically my whole plan for this project, because I don't have the time to learn programming much besides the basics, and this is just something to pass the time when I'm bored to see if I can actually make something on the Genesis. So hopefully no one attacks me when it appears I want all the work done for me, since it's admittedly what I'm doing and I'm not too serious about this, it's just for fun =p
So far it's of course difficult since I have no understanding of programming and am just doing guess work when messing with code. What my goal is right now is to just get a camera that follows the sprite on screen. I'm using moon's excellent Soleil example, which comes from here devster.proboards.com/index.cgi?action=display&board=basiegaxorz&thread=603&page=1#5815
I'm combining this with oompa loopa's Gelda example, just taking the sprite from it and the basic "if...then..else" commands that move the camera with the sprite depending on its position. The problem of course for me since I am not good at programming is that I can't figure out how to integrate this coding into the Soleil example. I've been doing lots of things and so far I can't seem to get the camera to follow the sprite, but just get it to respond to me pressing the direction keys. What I'm doing at the moment is just to get the sprite moving up and the camera going with it when it reaches a certain position. Here's what the Gelda code has:
The main part of the Soleil code I guessed I should be trying to rewrite in combination for that is this:
I'm guessing camera(1,1) = (joypad.1-joypad.0)*12 is what I'm wanting to mess with so i can instead of getting the camera to move when you press the up key, I get it to move when the sprite is at the right position. So I guessed up something dirty and ridiculous like this:
I can move the sprite up until it reaches the <= 64 position, but once it gets past that the screen keeps scrolling up. I've tried tons of different things too, too many to remember or list, map keeps looping crazy, link flies off the screen, it's all not the desired result of course.
So I'm wondering if anyone can give me a clue on how I can get a properly Zelda Link to the Past type thing going on here where the camera will follow the sprite when it should. I'm guessing it's not all that complex a thing to put into here, I'm just not figuring it out since I mainly can't figure out how to get the camera to stop being controlled by the D-pad but instead controlled by the sprites position, and to follow the sprite on when it moves.
Hope I made sense, go easy on me
So far it's of course difficult since I have no understanding of programming and am just doing guess work when messing with code. What my goal is right now is to just get a camera that follows the sprite on screen. I'm using moon's excellent Soleil example, which comes from here devster.proboards.com/index.cgi?action=display&board=basiegaxorz&thread=603&page=1#5815
I'm combining this with oompa loopa's Gelda example, just taking the sprite from it and the basic "if...then..else" commands that move the camera with the sprite depending on its position. The problem of course for me since I am not good at programming is that I can't figure out how to integrate this coding into the Soleil example. I've been doing lots of things and so far I can't seem to get the camera to follow the sprite, but just get it to respond to me pressing the direction keys. What I'm doing at the moment is just to get the sprite moving up and the camera going with it when it reaches a certain position. Here's what the Gelda code has:
while 1
sleep 1
j = joypad()
if j.0 then ' Up
if (gelda_y-2-camera_y) <= 64 then
gosub scroll_map_up
else
gelda_y = gelda_y - 2
gosub update_gelda_sprite
endif
The main part of the Soleil code I guessed I should be trying to rewrite in combination for that is this:
while 1
joypad = joypad(0)
camera(0,1) = (joypad.3-joypad.2)*12
camera(1,1) = (joypad.1-joypad.0)*12
camera(0,0)+= camera(0,1)
camera(1,0)+= camera(1,1)
cx = divide(camera(0,0),16)
cy = divide(camera(1,0),16)
render cx ,cy,cx ,cy+13
render cx+20,cy,cx+20,cy+13
render cx,cy ,cx+20,cy
render cx,cy+14,cx+20,cy+14
scroll left,camera(0,1)
scroll up,camera(1,1)
sleep 1
wend
I'm guessing camera(1,1) = (joypad.1-joypad.0)*12 is what I'm wanting to mess with so i can instead of getting the camera to move when you press the up key, I get it to move when the sprite is at the right position. So I guessed up something dirty and ridiculous like this:
movesprite gelda_sprite, 128+gelda_x, 128+gelda_y
while 1
joypad = joypad(0)
if joypad.0 then ' Up
if (gelda_y-2-cy) <= 64 then
camera(1,1) = (joypad.1-joypad.0)*12
else
gelda_y = gelda_y - 2
gosub update_gelda_sprite
endif
endif
I can move the sprite up until it reaches the <= 64 position, but once it gets past that the screen keeps scrolling up. I've tried tons of different things too, too many to remember or list, map keeps looping crazy, link flies off the screen, it's all not the desired result of course.
So I'm wondering if anyone can give me a clue on how I can get a properly Zelda Link to the Past type thing going on here where the camera will follow the sprite when it should. I'm guessing it's not all that complex a thing to put into here, I'm just not figuring it out since I mainly can't figure out how to get the camera to stop being controlled by the D-pad but instead controlled by the sprites position, and to follow the sprite on when it moves.
Hope I made sense, go easy on me