[SG] GM screw ups

Posted by Stained Glass on Feb. 3, 2007, 10:58 a.m.

This weekend I disided to run a few test to see why I was having so much trouble programming the platform engine for Funland Lex. To begin, I made a platform engine with just blocks and the player, nothing fancy at all. Then to monitor some things about the character that would be important to the game I had GM draw the stats so they could be monitored in real-time. The engine works fine, but I found some intresting things that could possibly be the reason for my troubles.

As I started the test I saw that as I was standing on the floor of the room I kept getting different y values. So I programmed in that I could add the players y value to a list of all the different y values. I found that I got 4 different y values for my character just standing on the floor at different times.

After finding this I added it in so that all the blocks that were below the players y would be partially transparent.

Because of the different y values sometimes the blocks are considered below the player and sometimes they are considered above.

Is this a GM screw up or is it something with my programming? You can download to file Here if you would like to see the file.

—————————————–

Aside from that I have started to learn a bit of HTML to hopefully design my site later. It is suprisingly easy so far and I should have a working site within the next week.

Images:

by Fool

by ptoing

by Setzer

by Snake

Above pixel made in MSpaint.

Comments

Siert 17 years, 9 months ago

I'm not sure but in the step event, at the end of the step event, put

x = round(x)
y = round(y)

flashback 17 years, 9 months ago

Do you disable gravity when standing on ground, or just have the blocks move the player back to xprevious and yprevious or some such system?

poultry 17 years, 9 months ago

HOLY CRAP

Episonage 17 years, 9 months ago

It's a conspiracy, I say!

Graydon 17 years, 9 months ago

Woah look at all the weird pictures.

Carlos_Ramos 17 years, 9 months ago

Nice engine you have there.

Actually when I downloaded, the program doesn't detect any y's.

However, in the coordinates, it give me a .25, instead of .75 at the same position.

I don't believe this should be too big a problem however, as pixel's are measured in whole numbers.

Stained Glass 17 years, 9 months ago

flashback-

Yes, I disable gravity when standing on the ground and I use move_contact_solid and vspeed=0 when colliding with the block.

Carlos_Ramos 17 years, 9 months ago

Running the program a couple more times, I noticed that every once in a while, the player sorta "hovers" one pixel over a block. This is due to the way you are calculating your falling event.

if place_free(x,y+1)
gravity=0.25
else
gravity=0

You are falling at a rate of .25 pixels, but are calculating for a free position 1 pixel away. If you change that code to

if place_free(x,y+gravity)
gravity=0.25
else
gravity=0

it should remove the hovering problem. Although you will move slower horizontally. This does, however, remove the chances of a y coordinate have a .50 or .75, and will instead always place the player to the .25.

Stained Glass 17 years, 9 months ago

Awesome, now that problem is fixed maybe I can get something working. Thanks Carlos.

Carlos_Ramos 17 years, 9 months ago

no problem, glad I could help :)