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
Unspecified
jhsoft
Posted: Jun 19 2008, 03:48 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) [--]


Hi there MFGG! As you might know, I am making another Bony Beetle fangame, and my hopes are to make it 10* better than the last! In my opinion, it would start with a more Marioish engine. If I could get slopes and friction, my fangame could definetely have more potential for level design, which is what I will be focussing on mostly. So basically, where should I start? I have no idea. Should I start out by looking at other engines, because that could end up with me copying codes into my game...and then I would't know how to add things in later. Again: I just want a starting point, to get me on the right track, I do not want you to tell me the entire code. Thank you.
Reminder:
1. Character movement with friction
2. Character movement up and down slopes
3. Enemy movement on slopes
4. Good collision with flat blacks if slope code doesn't work for flat (testing atm)

This post has been edited by jhsoft on Jun 22 2008, 02:41 AM


--------------------
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 19 2008, 04:00 PM
Quote Post


hagan bromas
[*]

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

Status: (0d) [--]


1.NO friction, leads to movement errors
use the step event
if !keyboard_check(vk_left) and !keyboard_check(vk_right)
{
if hspeed<0
hspeed+=0.2
if hspeed>=
hspeed-=0.2
}

2.
if y < other.y
{y = other.y-16
vspeed = 0}

replace the 16 with anything that fits

3.same as 2


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

user posted imageuser posted imageuser posted imageuser posted image
PMEmail PosterUsers WebsiteMSN
Top
United States
kremling
Posted: Jun 19 2008, 05:14 PM
Quote Post


Casual Member
[*][*][*]

Group Icon
Group: Members
Posts: 923
Member No.: 3240
Joined: 28-January 07

Status: (0d) [--]


Friction usually works fine for me... :/


--------------------
My Reference_1
Deviant Art
"Doing the wrong thing is always right"
Drawings by mfggers: Omnomlicous - Jazz - Bip
user posted image
PMEmail PosterUsers Website
Top
Japan
Soiyeruda
Posted: Jun 19 2008, 06:44 PM
Quote Post


Because retarded looking women is fun. :S
[*][*][*][*][*]
[*][*][*]

Group Icon
Group: Members
Posts: 3589
Member No.: 5004
Joined: 6-March 08

Status: (0d) [--]


I never really understood friction. I just used gravity and acceleration and deacceleration variables. It's easier, IMO.
PMEmail Poster
Top
Unspecified
jhsoft
Posted: Jun 19 2008, 09:54 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) [--]


@ Latia: I keep getting this:
FATAL ERROR in
action number 1
of Step Event
for object obj_bony:

COMPILATION ERROR in code action
Error in code at line 6:
hspeed-=0.2

at position 8: Unexpected symbol in expression.


--------------------
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
BurninLeo
Posted: Jun 20 2008, 12:21 AM
Quote Post


Member's Standard
[*][*]

Group Icon
Group: Members
Posts: 1617
Member No.: 2273
Joined: 3-July 06

Status: (0d) [--]


Here is what I use:

when character collides with slope:

repeat(20){
if(place_meeting(x,y+1,object_slope))break;
y+=1;
}
repeat(20){
if(!place_meeting(x,y,object_slope))break;
y-=1;
}

for object_slope step event:

solid=false

this code will only glitch when you try to jump onto the slope from underneath so keep that in mind

This post has been edited by Burnin#39;Leo on Jun 20 2008, 12:22 AM
PMEmail PosterMSN
Top
Unspecified
Miaxis
Posted: Jun 20 2008, 02:43 AM
Quote Post


hagan bromas
[*]

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

Status: (0d) [--]


QUOTE (kremling @ Jun 20 2008, 12:14 AM)
Friction usually works fine for me... :/

Friction causes the player object to lose speed even if itīs supposed to not lose speed, means you can start walking a few pixels and the friction immedialystops the player. Thatīs at least what I get when using friction.


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

user posted imageuser posted imageuser posted imageuser posted image
PMEmail PosterUsers WebsiteMSN
Top
United States
Ianprime0509
  Posted: Jun 20 2008, 09:23 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 19 2008, 10:54 PM)
@ Latia: I keep getting this:
FATAL ERROR in
action number 1
of Step Event
for object obj_bony:

COMPILATION ERROR in code action
Error in code at line 6:
hspeed-=0.2

at position 8: Unexpected symbol in expression.

That's because the code should be like this:
if !keyboard_check(vk_left) and !keyboard_check(vk_right)
{
if hspeed<0
hspeed+=0.2
if hspeed>=0
hspeed-=0.2
}

There was a missing 0 in the code.


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

user posted imageuser posted imageuser posted image
Signature version 3.0
PMEmail Poster
Top
Unspecified
Miaxis
Posted: Jun 20 2008, 10:09 AM
Quote Post


hagan bromas
[*]

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

Status: (0d) [--]


Whoops, my fault. Stupid Latia, like always. I think slopes should work with position checking, like BL explained.


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

user posted imageuser posted imageuser posted imageuser posted image
PMEmail PosterUsers WebsiteMSN
Top
Unspecified
jhsoft
Posted: Jun 21 2008, 03:15 AM
Quote Post


This grimmace is not the McDonalds kind.


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

Status: (0d) [--]


@Ianprime0509 and Latia: I'll try that right away! But I do have one question before I do this, what about walking down slopes? Wouldn't I kind of float off and not be able to jump?

Visual
_____
---------\ <--->Char moving right goes here
----------\
-----------\
------------\
-------------\

This post has been edited by jhsoft on Jun 21 2008, 03:15 AM


--------------------
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 21 2008, 03:42 AM
Quote Post


hagan bromas
[*]

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

Status: (0d) [--]


For the going down, there is the second position check that says y+=1, which stands for going down.


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

user posted imageuser posted imageuser posted imageuser posted image
PMEmail PosterUsers WebsiteMSN
Top
Unspecified
jhsoft
Posted: Jun 21 2008, 04:24 AM
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 21 2008, 03:42 AM)
For the going down, there is the second position check that says y+=1, which stands for going down.

Wow, Latia you are so helpful! I don't know what I would do with out your help. biggrin.gif

Also, I forgot to mention I'm a little less than clueless with codes (can do snd_play and thats about is biggrin.gif)
here is my fail code based off of what i've gathered

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

btw, Im starting on a clean slate, so no gravity or collision while falling yet. just this.

This post has been edited by jhsoft on Jun 21 2008, 05:27 AM


--------------------
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 21 2008, 04:43 AM
Quote Post


hagan bromas
[*]

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

Status: (0d) [--]


1.Goddess :P
2.sound_play not snd_play
3.the second part with the not ! is repetitive, which results either in an error, or negating the values theirself which causes it to get positive which will cause the player to decelerate even if heīs walking.
So, cut it off.


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

user posted imageuser posted imageuser posted imageuser posted image
PMEmail PosterUsers WebsiteMSN
Top
Unspecified
jhsoft
Posted: Jun 21 2008, 05:26 AM
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 21 2008, 04:43 AM)
1.Goddess :P
2.sound_play not snd_play
3.the second part with the not ! is repetitive, which results either in an error, or negating the values theirself which causes it to get positive which will cause the player to decelerate even if heīs walking.
So, cut it off.

1. Oops, typo. I wasn't referring you to as a deity (sorry ohmy.gif) I forgot a comma. Sorry about that. I ended up changing the whole post. Also, I guess I've developed a nasty habit. I need to stop using God as a replacement for words like wow.
2. Nevermind, I'm as clueless as it gets.

3. What do you mean by cut it off? What should I cut off?

This post has been edited by jhsoft on Jun 21 2008, 06:24 AM


--------------------
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 21 2008, 05:28 AM
Quote Post


hagan bromas
[*]

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

Status: (0d) [--]


No prob. Just saying.


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

user posted imageuser posted imageuser posted imageuser posted image
PMEmail PosterUsers WebsiteMSN
Top
Unspecified
jhsoft
Posted: Jun 21 2008, 09:12 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 (jhsoft @ Jun 21 2008, 05:26 AM)
3. What do you mean by cut it off? What should I cut off?

I just wanted to notify this edit, nobody seems to notice.


--------------------
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:23 AM
Quote Post


hagan bromas
[*]

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

Status: (0d) [--]


The counterpart of my code, itīs useless and causes the player to decelerate when heīs running.


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

user posted imageuser posted imageuser posted imageuser posted image
PMEmail PosterUsers WebsiteMSN
Top
Unspecified
jhsoft
Posted: Jun 22 2008, 02:39 AM
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:23 AM)
The counterpart of my code, itīs useless and causes the player to decelerate when heīs running.


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

Oh ok, so just.
if !keyboard_check(vk_left) and !keyboard_check(vk_right)
{
if hspeed<0
hspeed+=0.2
if hspeed>=0
hspeed-=0.2
}

This post has been edited by jhsoft on Jun 22 2008, 02:42 AM


--------------------
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
Spain
Sergeant DeeY
Posted: Jun 22 2008, 04:19 AM
Quote Post


~Heh Heh~
[*][*][*]

Group Icon
Group: Members
Posts: 1344
Member No.: 4730
Joined: 17-November 07

Status: (0d) [--]


You can use this code for slopes

Put this code in the step event of the object
if at relative position (0,4) there is object obj_slope_steep_r
move relative to position (0,-hspeed)
if at relative position (0,2) there is object obj_slope_r
move relative to position (0,-hspeed/2)
if at relative position (0,4) there is object obj_slope_steep_l
move relative to position (0,hspeed)
if at relative position (0,2) there is object obj_slope_l
move relative to position (0,hspeed/2)

Collision Event with object obj_slope_r:
set the vertical speed to 0
move relative to position (0,-1)

Collision Event with object obj_slope_l:
set the vertical speed to 0
move relative to position (0,-1)

Collision Event with object obj_slope_steep_r:
set the vertical speed to 0
move relative to position (0,-1)

Collision Event with object obj_slope_steep_l:
set the vertical speed to 0
move relative to position (0,-1)

Should this help!

This post has been edited by Darkyoshi on Jun 22 2008, 04:20 AM


--------------------
The signature will not be available when the new forums shows up.
~~DeeY~~
PMUsers Website
Top
Unspecified
Miaxis
Posted: Jun 22 2008, 04:38 AM
Quote Post


hagan bromas
[*]

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

Status: (0d) [--]


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

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

Oh ok, so just.
if !keyboard_check(vk_left) and !keyboard_check(vk_right)
{
if hspeed<0
hspeed+=0.2
if hspeed>=0
hspeed-=0.2
}

Yep.
Trying DYīs code...


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

user posted imageuser posted imageuser posted imageuser posted image
PMEmail PosterUsers WebsiteMSN
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.0699 ]   [ 13 queries used ]   [ GZIP Enabled ]   [ Server Load: 2.69 ]