Got physics? *Solved*

Posted by Mordi on Oct. 10, 2008, 9:56 a.m.

Do you know anything about GMPhysics? I have a slight annoying problem to deal with in a small game I am making.

I have made a level editor where you can place objects. The weapons, which I made a long time ago, don't fall through the floor. This week I made mines, but they fall through the floor when they are created at level-startup. The thing is, weapons and mines are created in the same script (at the same time), but when mines are created in-game (not at level-startup) they don't fall through the floor.

Here is the code for all the objects involved in this bug:

Quote:
Information about object: o_block

Sprite: m_block

Solid: true

Visible: true

Depth: -2

Persistent: false

Parent: o_solidparent

Mask: m_block

Create Event:

execute code:

h = create_body(x,y,STATIC,SHAPE_BOX,image_xscale*64,i

mage_yscale*64);

set_body_rotation(h, image_angle);

grass = true;

obj = object_index;

Draw Event:

execute code:

draw_sprite_ext(s_ground,0,x,y,image_xscale,image_

yscale,image_angle,c_white,1);

if (grass = true) { draw_sprite_ext(s_grass,0,x,y,image_xscale,image_y

scale,image_angle,c_white,1) }

Quote:
Information about object: o_mine

Sprite: s_mine

Solid: false

Visible: true

Depth: -3

Persistent: false

Parent: o_object_parent

Mask: <same as sprite>

Create Event:

execute code:

h = create_body(x,y,0.5,SHAPE_BOX,sprite_width,sprite_

height);

set_body_collide_ext(h);

obj = object_index;

image_speed = 0.2;

radius = 200; //Bomb detection and explosion radius

damage = 38; //Amount of damage the mine makes

soundTimer = 0;

soundInterval = 75;

sndTimer = global.snd_minetimer;

sndBoom = global.snd_mineexplode;

Destroy Event:

execute code:

sc_explode(x, y, radius, damage, sndBoom)

Alarm Event for alarm 0:

execute code:

instance_destroy();

End Step Event:

execute code:

if instance_exists(o_player)

{

if !(room = rm_editor)

{

//Check if player is close, so it can explode:

if (distance_to_object(o_player) < radius) and (alarm[0] = -1)

{

alarm[0] = room_speed * 1.7;

image_blend = c_red;

soundInterval = 10;

soundTimer = 10;

}

//Play constant beeping sound:

if (soundTimer = 0)

{

FMODSoundPlay3d(sndTimer,x,y);

soundTimer = soundInterval;

}

else

{

soundTimer -= 1;

}

}

}

As I said, everything works _except_ mines (when they are created at room start).

The sprite of the mine is about 40x15 or so.

Block is 64x64.

Anyone have a clue???

Here is the GMC topic: http://gmc.yoyogames.com/index.php?showtopic=400670

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

In other news, here is a song:

http://willhostforfood.com/users/Mordi/Mordi%20-%20I%20Should%20Have%20Told%20You%20[Noisy%20Pillars].mp3

Remix of a C64 chiptune.

Comments

PY 16 years, 1 month ago

No need to be a dick about it, either, flashback.

Cesar 16 years, 1 month ago

PY: Obviously you haven't been on the site long enough

It's the bi-annual flashback dick week.

Mordi 16 years, 1 month ago

Oh, so you're saying people here are generally not helpful, and I'm an idiot to think otherwise. Alright… :/

Who made you a mod?

Anyway, if anyone knows a good way to somehow convert a .gmk into a .gm6 file, let me know.

KaBob799 16 years, 1 month ago

Mission Accomplished

Theodore III 16 years, 1 month ago

I use Lateral Game Maker to do that, it will open gmk files and save it as gm6, very handy. Its a complete alternative IDE to GM but I only use it for this.

http://ismavatar.nfshost.com/lgm/index.php

flashback 16 years, 1 month ago

Quote:
Who made you a mod?
Canadonian. Years back.

I'm saying that you should post where such a question would normally go - which you DID: on the GMC help forum.

Juju 16 years, 1 month ago

I think the fatal assumption there is that the GMC can help people with advanced problems.

F1ak3r 16 years, 1 month ago

Post a problem, and you should get help for it, as well as people joking around. Take both, no need to delete things.

PY 16 years, 1 month ago

Rawr, you mean it's possible for him to be more of a dick than normal?

Jesus Christ.

Mordi 16 years, 1 month ago

F1ak3r: I like jokes too, but I only deleted one post. It was a rather large lolcat image. It was funny, but it didnt really have much to do with my problem. I deleted it because of its size.

flashback: I post both here and there when the topic there seems to have stagnated. JuJu was the one who solved the problem (most likely), so if I hadn't posted it here I would still be dragging my hair out.

Thank you Theodore, I'll try LateralGM out. =D