|
Post by Jonathan Cauldwell on Apr 8, 2012 19:10:36 GMT
Here's some quick code to align the player when going up ladders
IF KEY 0 IF LADDERABOVE LET IMAGE = 0 ANIMATE SPRITEUP ELSE SPRITELEFT IF LADDERABOVE ANIMATE ELSE SPRITERIGHT SPRITERIGHT IF LADDERABOVE ANIMATE ELSE SPRITELEFT ENDIF ENDIF ENDIF ENDIF
This gives the player a couple of pixels leeway either side of a ladder. You may also want to set a flag to disable normal left/right movement whenever the sprite aligns with a ladder.
Obviously, the code for aligning the player with a ladder below would be similar. Replace KEY 0 with KEY 1, LADDERABOVE with LADDERBELOW and SPRITEUP with SPRITEDOWN.
|
|
|
Post by gabriele1969 on Feb 16, 2013 19:11:44 GMT
Hi one thing I discovered is that if you put a solid wall block at the side of the ladder you don't need any alignment (i mean you don't need to write any extra code) just a simple "if ladder above etc etc" will do I used this little trick in Pitfall III and it worked allright I don't know in the end if it saves memory (i mean in the general memory balance) but at least it saves some memory from the RAM editor...
|
|