Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

[GM7] crumbling cliffs.


BOB_ROX

Recommended Posts

Hello, How can I start this?, Umm...I was browsing through the old forums yesterday for codes and stuff things might help me with my own game. I got a crumbling cliff codes and stuff, You know?, From Green Hill in sonic 1?. Yeah, That.

Basically it works fine, But whenever the room starts it crumbles on its own. NOT when sonic steps on it.

Ill post the codes I got:

objGimmickWeakPlatform (parent)

Create:

    ObjectActivated = false;
ObjectTimer = 0;[/CODE]

Step:

[CODE] // ---- Check if the collapse is activated ----------------------
if (ObjectActivated == true) {
// ---- Count down timer for collapse -----------------------
ObjectTimer = max(ObjectTimer - (1000/60)*global.GameplayInterval, 0);
if (ObjectTimer == 0) instance_destroy();

} else if (collision_rectangle(x-3, y-1, x+sprite_width+3, y+1, objPlayer, false, true)) {
ObjectTimer = 300;
ObjectActivated = true;
}[/CODE]

Destroy:

[CODE] // --- Setup falling platforms ---
var _ObjectHandle, _offset, _timing, _left, _top;
for (_offset=0; _offset<(sprite_width/16)+(sprite_height/16-1); _offset+=1) {
_left = _offset;
_top = (sprite_height/16-1);
_timing = 0;
repeat (min(_offset+1, sprite_height/16)) {
if (_left<(sprite_width/16)) {
_ObjectHandle = instance_create(x+(_left*16), y+(_top*16), objGimmickWeakPlatformPiece);
_ObjectHandle.sprite_index = sprite_index;
_ObjectHandle.Left = _left;
_ObjectHandle.Top = _top;
if (PlatformOrientation==consObjectOrientationLeft) //consObjectOrientationLeft = 1
_ObjectHandle.ObjectTimer = 50*((sprite_width/16)-_left)+(_timing*25);
else _ObjectHandle.ObjectTimer = 50*(_left)+(_timing*25);
}
_left = max(_left-1, 0);
_top = max(_top-1, 0);
_timing += 1;
}
}[/CODE]

Okay for the next object Ive basically got the actual object basically.

Create:

[CODE] Speed = 0;
Gravity = 0;
GravityForce = 0.2; // 0.2 when active
TopGravity = 8;
ObjectTimer = 0;
Left = 0;
Top = 0;[/CODE]

Step:

[CODE]
// ---- Count down timer for collapse -----------------------
ObjectTimer = max(ObjectTimer - (1000/60), 0);
if (ObjectTimer == 0) {
x += Speed;
y += Gravity;
Gravity = min(Gravity+GravityForce, TopGravity);
}[/CODE]

Outside of room:

Destroy the instance

Draw:

[CODE]draw_sprite_part(sprite_index, floor(image_index), Left, Top, 16, 16, x, y);[/CODE]

Thats all for the coding, Just..It works completely fine how it should But it gets destroyed before sonic even has a chance to step on it to make it crumble under his feet.

Any help?

Link to comment
Share on other sites

I didn't say to take it out, hahah. It just look like it was one of the ifs that activated the crumble sequence and since the condition for it looked kinda quirky from my perspective, I was suggesting that you mess around with it. If taking that out still causes problems, well now you know that's not what is causing it.

Experiment!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...