⌂ YolkfolkThe Dizzy Fansite
Community discussion

Climbing up and down

Started by Grandad on 23 November 2009 • 29,066 views

54 posts
#68907

I've been playing around with both Macon and Colin's climbing demos and although I seem to understand what's going on I just can't make a tile switch to a climbing animated tile. It's not really a case of switching the player to another character as there's no change of inventory etc.

I've tried changing the costume and adding 'dizzy_climb' as def 24 in the def.gs file and trying to use the code:

PlayerSet(P_TILE, PlayerGet(P_COSTUME)+PlayerGet(P_TILECLIMB));

which I saw in the movement file, but keep getting laughed at by the engine's pre-game check.

I even tried to set up a special custom climb movement and movement update sequence in the movement file and added to the 'enter states' section and added a define to it, but the engine just couldn't find it.

In Macon's demo you collide with the object which opens up the custom movement and then sets Dizzy in the Idle state, so all I'm really trying to do is to switch the 'idle' tile to an animated 'climb' tile (id 24) whilst Dizzy is in the custom movement mode. Any hints please.

Grandad

👍 0
#68908
I dunno about Macon's version as i haven't tried it but Colin's works fine, didn't touch the movement file form what i can remember.

The climb tile/turn tile should be some were on your 'map' with the correct ID. But it might be differant in Macons version.
👍 0
#68909
yes, this is the old method. i've since rewritten the climbing function. i'll post the new one!
👍 0
#68910

>>>>>>>>NOW V3 updated 28/09/10<<<<<<<<

you need to 1st copy this movement2.gs to the scripts folder (REPLACE ANY OLDER COPIES BEFORE V3)
then add it to the dizzy.gs list.

you need to replace the custom movement code at the bottom section of func HandlerPlayerUpdate()

with

//Custom movement
	custommove = PlayerGet(P_CUSTOMMOVE);
	if(custommove==0) // engine default
	{
		PlayerSet(P_W,CM_BOXW);
		PlayerSet(P_H,CM_BOXH);
	}
	else
	if(custommove==1) // scripted default
	{
		CM2_Update();
	}

add to the end of def.gs or gamedef.gs

int laddbott
int laddtop
int laddx
int climbtype
int clde
int del

the next part is added in game.gs and will be called when the ladder or rope is activated

//////////////////
//rope climbing
//////////////////
func RopeCollide()
{
	PlayerSet(P_Y, PlayerGet(P_Y) -2);
	PlayerSet(P_X,laddx);
        if(PlayerGet(P_CUSTOMMOVE)==0){PlayerEnterScripted();}
	PlayerSet(P_TILE, 28);
	if(PlayerGet(P_FLIP)==0){PlayerSet(P_X,laddx);}
	if(PlayerGet(P_FLIP)==1){PlayerSet(P_X,laddx+16);}
	scub = InventoryHasItem(ID_SCUBA);
	if(scub==1){PlayerSet(P_TILE, 56);}
	WaitFrames(6);	
	PlayerSet(P_CUSTOMMOVE,1);
	CM2_EnterIdle();
}
//////////////////
//ladder climbing
//////////////////
func LadderCollide()
{
	PlayerSet(P_Y, PlayerGet(P_Y) -2);
	PlayerSet(P_X,laddx);
        if(PlayerGet(P_CUSTOMMOVE)==0){PlayerEnterScripted();}
	PlayerSet(P_TILE, 26);
	scub = InventoryHasItem(ID_SCUBA);
	if(scub==1){PlayerSet(P_TILE, 56);}
	WaitFrames(6);	
	PlayerSet(P_CUSTOMMOVE,1);
	CM2_EnterIdle();
}

add this code into BeginNewGame() to initialise the 2 variables

climbtype=0;del=0;

the ladder activates when you hit a collider. this needs to be the length of the ladder.

you need tell it the ladder top and bottom positions.
also it needs to know the x position when dizzy is on the ladder
the x position must be a multiple of 4.

//////////////////
//rope collider
//////////////////
func CollideObject_1000_1() // moved into collision with rope
{
	laddtop=164;
	laddbott=244;
	laddx=596;
	clde=1000;idx=ObjFind(clde);ObjSet(idx,O_DISABLE,1);
	climbtype=1;
	RopeCollide();
}
//////////////////
//ladder collider
//////////////////
func CollideObject_1001_1() // moved into collision with ladder
{
	laddtop=164;
	laddbott=242;
	laddx=684;
	clde=1001;idx=ObjFind(clde);ObjSet(idx,O_DISABLE,1);
	climbtype=0;
	LadderCollide();
}

finally here are the tiles for dizzy climbing. you will need to re-colour the aqualung ones to match your game

dizzy climb tiles v3 zip

👍 0
#68920
Thanks Meph ...I can't believe I forgot to put the climbing tile in the map.

Thanks for the code and tiles Colin, this will help lots.

Grandad
👍 0
#68923
Hmm, can't get it to work. I copied the movement2 file and the tiles and followed your instructions to the letter and have checked all the coding (inc the cm2enteridle and the cm2enterup just to make sure, and everything seems OK.

All that happens is that when Dizzy collides with the actionObject the tile changes to the backview and clings onto the ladder, but when I press the up key all that happens is that Dizzy does a normal jump up as the default jumptile (tile 12).

Is there anything I need to check?
👍 0
#68928
it might be the player offset

here is a pic of a ladder in my game

you will see that the laddtop and laddbott are set higher than the actual ladder position. try taking 14 off of each.
👍 0
#71757

climb code now updated to V3. not only does it include the ladder climbing, but now includes rope climbing too.
here's a working demo map with the new code.

climbing_v3.zip

it works similar to the v2 but you need to tell it which type of climb to switch into

//ladder climbing
/////////////////
func CollideObject_1001_1() // moved into collision with ladder
{
	laddtop=164;
	laddbott=242;
	laddx=684;
	climbtype=0;
	LadderCollide();
}

//rope climbing
///////////////
func CollideObject_1000_1() // moved into collision with rope
{
	laddtop=164;
	laddbott=244;
	laddx=596;
	climbtype=1;
	RopeCollide();
}

when climbing ropes, you can switch rope sides. needed if a solid block is in your way. you can't jump off the rope if a solid block is in your way. press and hold direction key, till you fall off a clear side.

go up the page for the full instructions on V3

👍 0
#71805
Hi Colin !

Thank you for your climbing system ! I've implemented it to my game but I've found a bug I think (and in your demo example too).

Please, try the following in the demo:

1. go to the second room (or stay in the first room, it doesn't matter)
2. climb up the ladder and go off the ladder to the left or right
3. then climb down and e.g. in the half of the ladder climb up
4. at the end of the ladder you will see that Dizzy jumps up and fall down
5. after that ladder doesn't work

Then F6 repair this in the dev mode.
👍 0
#71812
remove this line in the ladders collideobject

cide=****;idx=ObjFind(clde);ObjSet(idx,O_DISABLE,1);

my game uses this line, as scrolling is turned on. it stops dizzy pausing when he switches rooms and picks up the collider again. really only works with ropes.
👍 0
#71817
right, I've worked out my own way of doing climbing now :smile:

It's pretty simple coding, and dead easy to put in the map too! It also works without you having to use colliders or any of that shiz :tongue:

give me an hour or so, and I'll put it up on Dizzy Stories :smile:
👍 0
#71818
Done! It's now up on Dizzy Stories :smile:

Personally I think it's easier to implement and use than Colin's code, but then I would say that wouldn't I? :tongue:

Sorry Col! :blush:
👍 0
#71819
cool, it does looked alittle easier to follow I'll have to try it out on the next game, i used the original coding on HLD and it was difficult.

Is Dizzy still invincible while climbing? or can he now be hurt under your new method?
👍 0
#71820
[quote data-userid="55" data-postid="71819"]

cool, it does looked alittle easier to follow I’ll have to try it out on the next game, i used the original coding on HLD and it was difficult.

Is Dizzy still invincible while climbing? or can he now be hurt under your new method?

[/quote]

He should be able to be hurt. I can't see any reason why not. I've not actually tried it - he should die as normal if killed, but tbh I'm not sure...

EDIT:: OOER! he can be hurt and killed, but the game freezes once he's killed! I'll have to fix that...

EDIT2:: I've fixed that. Turns out that I'd forgotten to tell the game to check the two new player statuses when checking deaths :tongue:
👍 0
#71821
Ive used Colin's climbing code & are quite a lot of climbing areas, are pretty much all in place now but I couldn't use any baddies whilst climbing as it caused an error if dizzy got hurt.
👍 0
#71822
yeah with the old code dizzy couldn't be hurt.. that was the whole point in me adding that climb in HLD lol which is why it now feels tagged on as an extra as it didn't do anything.

  {dizzy}:biggrin:
👍 0
#71824
I've just modified it slightly so that you can use the 'up' button for jumping when not in front of a ladder

EDIT:: also added a line in function CM_EnterWalk( dir ) that I'd forgotten about...

EDIT2:: I've added the snorkel tile too...
👍 0
#71840
Hi Colin !

Thanks, I've removed the 'clde' variable from all the code and now it works fine.

But there is another problem, or maybe a mistake. This tile - 'aqua_dizzy_rclimb 8.tga' has id '54' in your demo and I think that it has to be '58' and the tile 'aqua_dizzy_rclimbidle.tga' (id 59) is missing completely.

I've made this tile by myself from the climbing tile and it works good. So only a hint to your example.
👍 0
#82048

[quote data-userid="74" data-postid="67275"]

I thought i’d have a little go!

sort of works

ledge-hang-test.zip

up key to climb up and left key to fall back off!

[/quote]

Colin! We need this exact bit of code for the Crystal Kingdom remake! But this link is dead! Help us!! {yolkfolk}:tired:

👍 0
#82054
Pogie, not sure exactly what you need, but ages ago somebody did some code for jumping up and clinging to a ledge and then using the up arrow to climb up to the ledge. I used it in 'Daisy Dices With Death'. The details and explanation of what happens are near the the end of the game.gs file (starts with 'hanging on ledge, jumping up and right').
👍 0