# How do I make an object have an solid top only?

8 replies to this topic

GMC Member

• GMC Member
• 316 posts

Posted 14 September 2011 - 02:55 PM

How do I make it so I can stand on an object (and move and jump and stuff) and jump over it from directly below it?
I have Gamemaker lite and I'm using drag and drops.

Edited by Supertoad25, 14 September 2011 - 02:55 PM.

• 0

### #2 Zwetbaba

Zwetbaba

GMC Member

• GMC Member
• 87 posts
• Version:Unknown

Posted 14 September 2011 - 03:04 PM

You can check whether the y position of the object is lower or higher than the y position of the block.
If the y position of the object is higher, you just make the block solid.
• 0

### #3 Gangsterman

Gangsterman

GMC Member

• GMC Member
• 35 posts

Posted 14 September 2011 - 03:06 PM

well i haven't use D&D for a lonnnnnnnnnggggggggggggggg time so basic is you drag the run script(the one looks like a paper without the green arrow in the control section)
put in it:
```if place_meeting(x,y+1,"your block object name")
//example:
{
vspeed=0
gravity=0
}
```
if you are lazy to learn GML
drag the "if collision free" icon:put in x,y+1,solid only
and then the collision code...

oops,forgot
```if place_meeting(x,y+1,"your block object name")
//example:
{
vspeed=0
gravity=0
}
```
(maybe)

Edited by Gangsterman, 14 September 2011 - 03:10 PM.

• 0

GMC Member

• GMC Member
• 316 posts

Posted 14 September 2011 - 03:40 PM

You can check whether the y position of the object is lower or higher than the y position of the block.
If the y position of the object is higher, you just make the block solid.

What is the best way to do that?
• 0

### #5 Zwetbaba

Zwetbaba

GMC Member

• GMC Member
• 87 posts
• Version:Unknown

Posted 14 September 2011 - 04:14 PM

You can check whether the y position of the object is lower or higher than the y position of the block.
If the y position of the object is higher, you just make the block solid.

What is the best way to do that?

With D&D-actions?
Something like this:

Variable: "y" / Value: "obj_player.y" / Operation: "Larger Then"

Variable: "solid" / Value: "true"

Variable: "solid" / Value: "false"

I hope that works...
• 0

GMC Member

• GMC Member
• 316 posts

Posted 15 September 2011 - 10:14 PM

With D&D-actions?
Something like this:

Variable: "y" / Value: "obj_player.y" / Operation: "Larger Then"

Variable: "solid" / Value: "true"

Variable: "solid" / Value: "false"

I hope that works...

No, he's just standing above it, frozen.
Anyways, do you know how to randomly assign an number to an variable then check to see what number it is? also make it an certain range of numbers?
• 0

### #7 Zwetbaba

Zwetbaba

GMC Member

• GMC Member
• 87 posts
• Version:Unknown

Posted 16 September 2011 - 02:05 PM

Anyways, do you know how to randomly assign an number to an variable then check to see what number it is? also make it an certain range of numbers?

Maybe you mean something like this:

Variable: "<Any>" / Value: "floor(random(61))"

This returns, for example, a number between 0 and 60 (never 61).

Edited by Zwetbaba, 16 September 2011 - 02:06 PM.

• 0

GMC Member

• GMC Member
• 316 posts

Posted 24 September 2011 - 10:45 PM

Anyways, do you know how to randomly assign an number to an variable then check to see what number it is? also make it an certain range of numbers?

Maybe you mean something like this:

Variable: "<Any>" / Value: "floor(random(61))"

This returns, for example, a number between 0 and 60 (never 61).

Here's an picture of the code: http://i55.tinypic.com/14tx43k.jpg
It's like till the end, and there are as many start blocks as there are end blocks, but all it does is spawn all the items at the same time, I want some items to be rarer than others, and I want it so sometimes items won't even appear.

have any ideas why on that?
• 0

### #9 Zwetbaba

Zwetbaba

GMC Member

• GMC Member
• 87 posts
• Version:Unknown

Posted 25 September 2011 - 08:07 AM

Your D&D blocks aren't in a good order. You have to do it like this:

...and so on.
Because in your code; when the variable "item" is smaller than 23 it will automatically create every instance.
And if "item" is not smaller than 23, it will just do nothing.
• 0

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users