Powered by Invision Power Board

 
  Pages: (2) 1 [2]  ( Go to first unread post ) Reply to this topicStart new topicStart Poll

> Game Maker 7 Help: Using Friction and Slopes, I'd rather not use jump to postition
United States
Ianprime0509
  Posted: Jun 22 2008, 06:43 AM
Quote Post


My favorite E3 game so far
[*][*]

Group Icon
Group: Members
Posts: 488
Member No.: 3316
Joined: 17-February 07

Status: (0d) [--]


QUOTE (jhsoft @ Jun 22 2008, 03:39 AM)

EDIT: This still make me slowly move to the left.

Try this in the step event:

if (hspeed < 0.2) and (hspeed > 0)
hspeed = 0
if (hspeed > -0.2) and (hspeed < 0)
hspeed = 0


Or something like that.


--------------------

user posted imageuser posted imageuser posted image
Signature version 3.0
PMEmail Poster
Top
Unspecified
jhsoft
Posted: Jun 22 2008, 02:40 PM
Quote Post


This grimmace is not the McDonalds kind.


Group Icon
Group: Members
Posts: 78
Member No.: 2850
Joined: 24-October 06

Status: (0d) [--]


QUOTE (Latia @ Jun 22 2008, 04:38 AM)
Yep.
Trying DY´s code...

...Yep? I mean that with out me pressing any keys at all, I slowly move to the left. I cut out my part of the code...


--------------------
Current Projects:
Bony Beetle Strikes Back: Working Title
Coding:|||||||||
Level Design:|||||||||
Sprites and Graphics:|||||||||
Sounds:||||||||||
In Total:||||||||||



Which Neglected Mario Character Are You?

CODE
Thwomp Master says (5:59 AM):
I'm not crying
Thwomp Master says (6:00 AM):
And I never complained
Thwomp Master says (6:00 AM):
I just said I have 56 complaints
PMEmail PosterUsers WebsiteMSN
Top
Unspecified
Miaxis
Posted: Jun 22 2008, 02:44 PM
Quote Post


hagan bromas
[*]

Group Icon
Group: Members
Posts: 1799
Member No.: 2793
Joined: 12-October 06

Status: (0d) [--]


use Ianprime´s code, the "Trying DY´s code...." was a selfnote. ohmy.gif


--------------------
user posted image

user posted imageuser posted imageuser posted imageuser posted image
PMEmail PosterUsers WebsiteMSN
Top
Unspecified
jhsoft
Posted: Jun 22 2008, 08:49 PM
Quote Post


This grimmace is not the McDonalds kind.


Group Icon
Group: Members
Posts: 78
Member No.: 2850
Joined: 24-October 06

Status: (0d) [--]


QUOTE (Latia @ Jun 22 2008, 02:44 PM)
use Ianprime´s code, the "Trying DY´s code...." was a selfnote. ohmy.gif

Alright, trying right now biggrin.gif


--------------------
Current Projects:
Bony Beetle Strikes Back: Working Title
Coding:|||||||||
Level Design:|||||||||
Sprites and Graphics:|||||||||
Sounds:||||||||||
In Total:||||||||||



Which Neglected Mario Character Are You?

CODE
Thwomp Master says (5:59 AM):
I'm not crying
Thwomp Master says (6:00 AM):
And I never complained
Thwomp Master says (6:00 AM):
I just said I have 56 complaints
PMEmail PosterUsers WebsiteMSN
Top
Unspecified
jhsoft
Posted: Jun 22 2008, 08:50 PM
Quote Post


This grimmace is not the McDonalds kind.


Group Icon
Group: Members
Posts: 78
Member No.: 2850
Joined: 24-October 06

Status: (0d) [--]


I tried a bunch of combonations of using Ianprime's code with Latia's, like putting Ianprime's code at the bottom of Latia's, making them both seperate codes, and even trying each one by themselves. None worked, but this is the one that I am suprised isn't working.
if !keyboard_check(vk_left) and !keyboard_check(vk_right)
{
if (hspeed < 0.2) and (hspeed > 0)
hspeed = +0.2
if (hspeed > -0.2) and (hspeed < 0)
hspeed = -0.2
}

I changed Ianprime's 0 hspeed values to relative values of 0.2 and -0.2. This code does absolutely nothing and I'm not sure why.

This post has been edited by jhsoft on Jun 22 2008, 09:39 PM


--------------------
Current Projects:
Bony Beetle Strikes Back: Working Title
Coding:|||||||||
Level Design:|||||||||
Sprites and Graphics:|||||||||
Sounds:||||||||||
In Total:||||||||||



Which Neglected Mario Character Are You?

CODE
Thwomp Master says (5:59 AM):
I'm not crying
Thwomp Master says (6:00 AM):
And I never complained
Thwomp Master says (6:00 AM):
I just said I have 56 complaints
PMEmail PosterUsers WebsiteMSN
Top
Unspecified
Miaxis
Posted: Jun 22 2008, 11:57 PM
Quote Post


hagan bromas
[*]

Group Icon
Group: Members
Posts: 1799
Member No.: 2793
Joined: 12-October 06

Status: (0d) [--]


Because you´re practically telling GM that you want the player object to at least have that hspeed value.


--------------------
user posted image

user posted imageuser posted imageuser posted imageuser posted image
PMEmail PosterUsers WebsiteMSN
Top
Unspecified
jhsoft
Posted: Jun 24 2008, 01:28 PM
Quote Post


This grimmace is not the McDonalds kind.


Group Icon
Group: Members
Posts: 78
Member No.: 2850
Joined: 24-October 06

Status: (0d) [--]


QUOTE (Latia @ Jun 22 2008, 11:57 PM)
Because you´re practically telling GM that you want the player object to at least have that hspeed value.

It was late when I wrote that, let me try one more time, but then I need to go.
if !keyboard_check(vk_left) and !keyboard_check(vk_right)
{
if (hspeed > 0)
hspeed = +0.2
if (hspeed <0)
hspeed = -0.2
}

Would that work? I have to go now, sorry. I'll be back around in 4 hours about.


--------------------
Current Projects:
Bony Beetle Strikes Back: Working Title
Coding:|||||||||
Level Design:|||||||||
Sprites and Graphics:|||||||||
Sounds:||||||||||
In Total:||||||||||



Which Neglected Mario Character Are You?

CODE
Thwomp Master says (5:59 AM):
I'm not crying
Thwomp Master says (6:00 AM):
And I never complained
Thwomp Master says (6:00 AM):
I just said I have 56 complaints
PMEmail PosterUsers WebsiteMSN
Top
United States
Ianprime0509
  Posted: Jun 24 2008, 03:29 PM
Quote Post


My favorite E3 game so far
[*][*]

Group Icon
Group: Members
Posts: 488
Member No.: 3316
Joined: 17-February 07

Status: (0d) [--]


if !keyboard_check(vk_left) and !keyboard_check(vk_right)
{
if hspeed<0
hspeed+=0.2
if hspeed>=0
hspeed-=0.2
}

That = is telling the game that if the hspeed is greater than or equal to 0 than it will move to the left. If you remove that = then it should work.


--------------------

user posted imageuser posted imageuser posted image
Signature version 3.0
PMEmail Poster
Top
United States
Bigbowsa
Posted: Jun 25 2008, 12:14 PM
Quote Post


lol showbiz bowser
[*]

Group Icon
Group: Members
Posts: 1225
Member No.: 3187
Joined: 14-January 07

Status: (0d) [--]


This is what I use for friction:

In the create event, set a variable named "hold" (or something that will tell you that it's friction) to a value you want. Then, in the step event, stick this code in somewhere:
CODE
if keyboard_check(vk_left){}else
if keyboard_check(vk_right){}else
{
if hspeed > 0
hspeed-=hold
if hspeed < 0
hspeed+=hold
if hspeed < hold
if hspeed > -hold
hspeed = 0
}


This post has been edited by Bigbowsa on Jun 25 2008, 12:15 PM


--------------------
PMEmail Poster
Top
Unspecified
exenefevex
Posted: Jun 25 2008, 01:18 PM
Quote Post


Regular
[*][*][*]

Group Icon
Group: Members
Posts: 258
Member No.: 3660
Joined: 19-April 07

Status: (0d) [--]


This is the second time I've seen you post this, so I'm going to point it out just in case you haven't noticed:

if !keyboard_check(vk_left) and !keyboard_check(vk_right)
{
if (hspeed < 0)
hspeed = +0.2
if (hspeed > 0)
hspeed = -0.2
}

What you've got there literally means "set hspeed to exactly positive 0.2" and "set hspeed to exactly negative 0.2". Everyone else is posting the code

if !keyboard_check(vk_left) and !keyboard_check(vk_right)
{
if (hspeed < 0)
hspeed += 0.2
if (hspeed > 0)
hspeed -= 0.2
}

which is shorthand for saying hspeed = hspeed +/- 0.2, or "add/subtract 0.2 to the current value of hspeed, then set hspeed to the result."

There's a 99% chance you already know this, but I figure better safe than sorry...

(also what Bigbowsa posted should work perfectly on level ground)

This post has been edited by xn--e5x on Jun 25 2008, 01:20 PM


--------------------
PM
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

  Topic Options Topic Options Pages: (2) 1 [2]  Reply to this topicStart new topicStart Poll

 




[ Script Execution time: 0.0562 ]   [ 13 queries used ]   [ GZIP Enabled ]   [ Server Load: 2.84 ]