Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 41  Next  [ 816 posts ]  Reply to topicPost new topic 
Coding Help, Questions and Issues relating to coding
Author Message
 [ca]
 Post subject: Re: Coding Help
PostPosted: Tue Jun 25, 2013 2:16 pm 
User avatar
The Quantifiably Quip-tic QC Dude
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
I've been figuring out how to get the color value around the open tag ([color=c_red]).

Code:
string_copy("[color=c_red]", string_pos("[color=", "[color=c_red]") + 7, string_pos("]", "[color=c_red]") - string_pos("[color=", "[color=c_red]") - 1 );


No luck with implementing it into the engine, though.

_________________
<insert funny sig image here>

Image Refs - Something new's gonna show up here, I just know it! - DeviantArt - YouTubeImage
???!, 10%
 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Wed Jul 03, 2013 12:53 pm 
User avatar
Stay fresh!
Member
[*]
[*]
[*]
[*]
[*]

[*]
Hey guys, I seem to be having a bit of trouble with collisions in the game I'm working on. Currently, the game currently treats all collisions with the collision block as if the player were landing on top of it. Any ideas on how I could check if the player hits the object from beneath or the side? The method I normally use doesn't seem to want to work with the way I've set the player up.

And here is the code for the collision event:
Syntax: [ Download ] [ Hide ]
Using gml Syntax Highlighting
move_contact_solid(270,12);
gravity = 0;
vspeed = 0;

//Let the game know that the player
//is no longer jumping
if(hasJumped == true)
    hasJumped = false;
if(jumping == true)
    jumping = false;

if(hasFlutterJumped == true)
    hasFlutterJumped = false;
if(flutterJumping == true)
    flutterJumping = false;
if(flutterJumpTimer != maxFlutterJumpTimer)
    flutterJumpTimer = maxFlutterJumpTimer;

canApplyFlutterJump = false;
 


Also, the collision object is currently a solid. I'd prefer to use non-solid objects, but I've never really dealt with them too much in Game Maker. If someone wouldn't mind showing me how to modify the existing code (or at least point me in the right direction), then I'd really appreciate it. And you might even get a virtual cake if you can help.

_________________
It's a me, Superbowser! :cool:
 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Wed Jul 03, 2013 7:14 pm 
User avatar
Lawful Evil
Member
[*]
[*]
[*]
[*]
[*]

[*]
I don't remember entirely how Game Maker handles solid objects, but I remember it being rather annoying. Don't they prevent almost all collisions with them? There's usually plenty of situations in a game where projectiles and whatnot are supposed to move through solids.

This might clash a bit with how you're trying to do things, but I always put solid collisions in the Step event rather than the Collision event, so as to avoid getting stuck in solids. Simply use collision_rectangle(bbox_left+horizontalOffset,bbox_top+verticalOffset,bbox_right+horizontalOffset,bbox_bottom+verticalOffset,YourSolidParent,1,1) to test for solid collisions, with one's offsets normally being one's speeds. Why, one could even use the same if statement for collisions with solids above and below the character, should the two situations not be that different. For example:

Code:
if (collision_rectangle(bbox_left,bbox_top+vspeed,bbox_right,bbox_bottom+vspeed,Solid,1,1) && vspeed != 0)
{
 move_contact_all(270,vspeed);
 if (vspeed > 0)
 {
  //Put all your code that refreshes all those double jump variables here
  gravity = 0;
 }
 else
  //Anything that only happens when bumping one's head on the ceiling
 vspeed = 0;
}


Last edited by Magnemania on Thu Jul 04, 2013 9:01 am, edited 1 time in total.
_________________
Image
Magikoopa Security Force, the Mario Action-Strategy game!
  It's time to fight for Bowser!
 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Thu Jul 04, 2013 12:01 am 
User avatar
Stay fresh!
Member
[*]
[*]
[*]
[*]
[*]

[*]
Alright, thanks for your help! I'll try it as soon as I get a chance (which may not be until Friday with tomorrow being July 4th and all).

_________________
It's a me, Superbowser! :cool:
 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Fri Jul 05, 2013 1:43 pm 
User avatar
Stay fresh!
Member
[*]
[*]
[*]
[*]
[*]

[*]
The code works for solid collisions, but it still doesn't work for non-solid collisions and it brings up a new issue. First of all, the character sinks through the floor if both he and the collision object is non-solid. On the other hand, if one or both of the objects are solid, then it prohibits the character from being able to move left and right while he is on the ground. He is still able to jump and he can move while in midair though. Any ideas why?

_________________
It's a me, Superbowser! :cool:
 
Top
Offline 
 User page at mfgg.net
 
 [gb]
 Post subject: Re: Coding Help
PostPosted: Sat Jul 06, 2013 12:37 am 
I never really was on your side.
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
I think it may be caused because GameMaker's collision doesn't necessarily do precise checking. If, for example, you are going at a vspeed of 4, and you are 3 pixels above the solid, when you land, you will be 1 pixel inside the solid, since vspeed of 4 moves you down 4 pixels per step. Something you could put in the collision code for the player with the solid would be
Code:
y=other.y-16

where you would replace 16 with the height from the bottom of the sprite's bounding box to it's point of origin. I hope I helped

 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Sat Jul 06, 2013 5:44 pm 
User avatar
Stay fresh!
Member
[*]
[*]
[*]
[*]
[*]

[*]
Well, that fixes the problem with the player "sticking" to the floor while trying to move, but now the player can't jump. I believe the reason why is because he technically isn't ever touching the ground anymore, so it isn't able to set any of the variables I have in play. I bet I could get it to work with a little bit of tweaking though. Thanks for the help.

_________________
It's a me, Superbowser! :cool:
 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Sat Jul 06, 2013 11:18 pm 
User avatar
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
@superbowser: were you able to fix you problem?

 
Top
Offline 
 
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Sat Jul 06, 2013 11:46 pm 
User avatar
Stay fresh!
Member
[*]
[*]
[*]
[*]
[*]

[*]
If I remember correctly, I was able to get the collisions from different angles to work correctly. However, I wasn't ever able to get non-solid collisions working. Would you happen to have any ideas on how to do this?

_________________
It's a me, Superbowser! :cool:
 
Top
Offline 
 User page at mfgg.net
 
 [gb]
 Post subject: Re: Coding Help
PostPosted: Sun Jul 07, 2013 1:06 am 
I never really was on your side.
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
Superbowser wrote:
If I remember correctly, I was able to get the collisions from different angles to work correctly. However, I wasn't ever able to get non-solid collisions working. Would you happen to have any ideas on how to do this?

Is there a specific part you need help with?

 
Top
Offline 
 User page at mfgg.net
 
 [zz]
 Post subject: Re: Coding Help
PostPosted: Fri Jul 19, 2013 4:43 pm 
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
soooo assuming we're allowed to "bump" our old questions, did anybody find a solution to my jumpthrough platform problem?

 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Sat Jul 20, 2013 4:51 pm 
User avatar
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
@WiiBoy4Ever: Send the .gmk and I'll look into the problem for you.

 
Top
Offline 
 
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Sun Jul 21, 2013 6:40 pm 
User avatar
AKA the Greenish Hero
Member
[*]
I'm having a relatively simple but seemingly unfixable problem with my "collision with solids". I curently have it set so that my character moves to contact in direction "direction", but I found that it actually performs more favorably if I have it move in direction 270, but this messes with collision from the bottom of the solid object. By leaving it as "direction", my character will sometimes, while moving, jump a pixel ahead of where he's supposed to land, making some side collisions very unfavorable. I've tried clarifying that if my character is NOT colliding with a solid object from relative y-1, then move to contact at direction 270, else move to contact in direction "direction", but this doesn't help.

So is there a way I can still have move to contact in direction "direction", but ONLY move in directions 180, 0, 90 and 270?

_________________
Want to try an original game?
viewtopic.php?f=8&t=13625

Click it and you'll live forever!
 
Top
Offline 
 
 
 [jp]
 Post subject: Re: Coding Help
PostPosted: Mon Jul 22, 2013 3:39 pm 
User avatar
Yeah, I don't Even...
Member
[*]
[*]
[*]
[*]
[*]

[*]
Well first of all can you give me an example of what you mean, because honestly the description you gave is kinda vague, I'm taking a guess it's a platform engine. And the way you've explained it, it doesn't really make much sense, can you post an example gmk or something of what you are trying to do, it'd help greatly if I can see what you are actually doing instead of you trying to explain it.

(Also, please stop makign those other topics about stuff like this, just because you don't get attention right away doesn't mean you NEED to make a new thread, people have lives too you know, and nobody can be on 24/7)

_________________
Spoiler:
 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Mon Jul 22, 2013 7:32 pm 
User avatar
AKA the Greenish Hero
Member
[*]
https://app.box.com/s/m7lxtrvqtb4go0jwes56

Here is a link to a sample gmk file, everything I want to do is expalined there. If anyone can help me with this problem, I would GREATLY GREATLY appreciate it

_________________
Want to try an original game?
viewtopic.php?f=8&t=13625

Click it and you'll live forever!
 
Top
Offline 
 
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Tue Jul 23, 2013 12:10 am 
User avatar
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
@pickleboy: I'm unable to recreate whatever problem you've found wrong with you example engine. I read the text you supplied in-game but I don't really see what your problem is, everything seems to play just fine.

 
Top
Offline 
 
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Tue Jul 23, 2013 2:21 pm 
User avatar
AKA the Greenish Hero
Member
[*]
kremling wrote:
@pickleboy: I'm unable to recreate whatever problem you've found wrong with you example engine. I read the text you supplied in-game but I don't really see what your problem is, everything seems to play just fine.


I'm not sure how long you tested the engine, but you must have noticed the jump-forwards in the landing. It's not noticeable if the room isn't moving, but pay attention to the lines of the floor and tell me that they never maintain a constant speed when my character is landing and moving at the same time.

It's hard to describe it if you don't see it.

https://app.box.com/s/m7lxtrvqtb4go0jwes56

_________________
Want to try an original game?
viewtopic.php?f=8&t=13625

Click it and you'll live forever!
 
Top
Offline 
 
 
 [jp]
 Post subject: Re: Coding Help
PostPosted: Tue Jul 23, 2013 2:26 pm 
User avatar
Yeah, I don't Even...
Member
[*]
[*]
[*]
[*]
[*]

[*]
Well, I'm not sure if this was the bug you mentioned but it was hard to replicate, but when I had the player char next to the wall right when it was moving and jumped, the char seems to have thought the solid top that you can't all through was a solid and the player hit it and went back down.

_________________
Spoiler:
 
Top
Offline 
 User page at mfgg.net
 
 [us]
 Post subject: Re: Coding Help
PostPosted: Tue Jul 23, 2013 6:17 pm 
User avatar
AKA the Greenish Hero
Member
[*]
Shadow Kami wrote:
Well, I'm not sure if this was the bug you mentioned but it was hard to replicate, but when I had the player char next to the wall right when it was moving and jumped, the char seems to have thought the solid top that you can't all through was a solid and the player hit it and went back down.


As in, the char hit the solid-top as if it was a complete solid? that's odd, it's never happened to me, but I'll look into it. But as for the problem at hand, it seems you guys don't notice it, which is understandable, but important. You guys don't see the jittering in the camera movements at all when he lands?

_________________
Want to try an original game?
viewtopic.php?f=8&t=13625

Click it and you'll live forever!
 
Top
Offline 
 
 
 [ca]
 Post subject: Re: Coding Help
PostPosted: Wed Jul 24, 2013 12:00 am 
User avatar
The Quantifiably Quip-tic QC Dude
Member
[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
[*]
[*]
[*]
[*]

[*]
I've got another Game Maker query. I know it's possible to make rotating platforms working using custom movement variables (like x += xspeed), as I have here.

Create Event:
Code:
xspeed = 0;
yspeed = 0;
dir = 1;


Step Event:
Code:
x += xspeed;
y += yspeed;

dir += 1;
xspeed = lengthdir_x(1, dir);
yspeed = lengthdir_y(1, dir);


But is there a way to get the platform to rotate at a fixed distance away from a certain point?

_________________
<insert funny sig image here>

Image Refs - Something new's gonna show up here, I just know it! - DeviantArt - YouTubeImage
???!, 10%
 
Top
Offline 
 User page at mfgg.net
 
« Previous topic | Next topic »
Display posts from previous:  Sort by  
Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 41  Next  [ 816 posts ]  Reply to topicPost new topic 


Who is online

Users browsing this topic: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group