Game - Need help on part that seemed so easy

Posted by Medieval on Nov. 5, 2007, 11:30 a.m.

Due to failure of my previous blog entry, I've been afraid of posting for a while.. So I went to the Rules page, and read what was there… and decided to post another entry here, asking people's help. Nobody helped me back at the GMC. Call me a donkey if it's not allowed here again, please.

I am asking help regarding GM, actually. As I am now making a platformer allowing the player to walk on the walls and the ceiling, I found out that it was not as easy as it seemed. As I progressed (Not too fast), I had to stop at one problem.. One which I don't know how to fix. I don't know how to do the keyboard movement. Yeah, it's a shame, I tried doing anything that didn't exceed my knowledge.. without success. Here is some of the code I used:

Create Event

//INIT VARIABLES
gravspd=6;
grav=0.5;
grav_dir=-90;
walkdir=grav_dir+90;

Step event

gravity_direction=grav_dir;
if (place_free(x,y+speed))
{
    gravity=grav;
}
else
{
    gravity=0;
}

if (speed>gravspd)
{
    speed=gravspd;
}

if (grav_dir=360) {grav_dir=0;}
if (walkdir>=360) {walkdir-=360;}

if (keyboard_check(vk_right))
{
        //The place where I'm stuck.
}

I'd loooove some good help on this, so please, if you know, post :)

My first not pointless entry, and.. my second entry overall.

Comments

PY 17 years, 1 month ago

Keep at it, I find doing stuff myslef much more phun.

Medieval 17 years, 1 month ago

True, but I'm really stuck.

Castypher 17 years, 1 month ago

I don't know why this would be against the rules here.

I also don't know why so many people are afraid of the built-in functions gravity and gravity_direction. They work just fine, but in most cases, it <i>is</i> better to make your own movement variables.

You have to be more specific on what you're trying to accomplish. If you want a special movement code, you'll have to make up those variables, too. Once you stray from built-in functions, you're going to have to do <i>everything</i> your way.

PY 17 years, 1 month ago

Yes, I do use inbuilt functions, but only for minor thangs

Medieval 17 years, 1 month ago

Basically my problem is that I can't use speed for the walking, as it's already in use for gravity. I would need a function that makes it go to a direction with a certain speed..

However I think I have just found a part of the solution to my problem… Using motion_set();

EDIT

Nope, guess it didn't work out as I wanted it to… Help, anyone?

Castypher 17 years, 1 month ago

Motion_set wasn't bound to work. Like I said, DIFFERENT variables. EG: xsp, ysp.

Medieval 17 years, 1 month ago

Interesting.. explain.

Myth 17 years, 1 month ago

Make another platform engine where the gravity's direction is 0, and where you jump towards the left end of the screen. Then combine them. I mean when you're character is meant to walk on the wall change the engine, and for example after 5 secs set it back to the primary engine, so that you're character falls off the wall. Well, I know that sounds a little weird, but it should work fine in a well organized piece of code.

Medieval 17 years, 1 month ago

It's.. Not exactly what I'm trying to achieve, but your suggestion might get me somewhere.