Comments

Log in with itch.io to leave a comment.

Viewing most recent comments 1 to 23 of 43 · Next page · Last page

se puede usar para game maker 2.3.7

??

Yeah, it should work in any version after 2.3
Give it a shot and report back!

I've been struggling with my collision code, this worked flawlessly once i figured out how to apply it. thank you.

hey i hope your still reading the comments, how do you do *both* tile & object based collision?

So sorry for the noobie question but how might I add an idle pose to this? thank youu! 

The code is very good.

It will be clean without errors.

Thank you.

There is a tremor when the player moves in the code I made.

(5 To remove any jittering, draw your sprite with the given draw position)

I'd like to use the drawX and drawY codes separately.

Can I apply drawX, drawY to the code I made?

I assume so... They are just variables that are present in the struct, so you can use them however you see fit.

This might be a bit of an ask but does this system play nicely with "height" in top-down games? I've been trying to come up with a solid solution for allowing the character to jump or move across areas of different heights (I've seen solutions using a pseudo z-axis or they might call it z-height).

I know you've made a lot of these types of games (e.g. Secret of Mana) and was wondering if you had any suggestions.

Thanks!

It is possible, yes.
The thing about any collision system is it ultimately comes down to "can I move here? Yes or no." right? That's what place_meeting is.
TDMC allows you to define your own place_meeting function, which you can make as complicated as you want. So: yes, totally possible. Obviously not something that it does "out of the box" but changing how you define the collision check function is all it really takes.

Appreciate the reply, thanks!

(+1)

I stucked in the wall in my own collision system while above boxes and ramps objects in z-Axis. I gave up and tried this system. I just replaced the place_meeting to my custom script, and VOILA!! Everything running smoothly. Thanks Pixelated!

(+1)

Great project. Does what it claims to do, very well.

@Pixelated Pope are you on hand to help with some customization?

(+2)

I could be, but it really depends on what you want changed. The system is pretty "locked in" so something that might seem like a modification or an adjustment could mean a full re-write.  Feel free to hit me up on Discord to chat. My DMs are open to those who are members of the GM Discord server: https://discord.gg/gamemaker

Hello, thanks for this awesome script!  Ive found an infinte loop and replicated it in your demo.  Generally if the character clips into a wall the game will still run, however in corners this can freeze the game.  In RmBasicDemo, position the character to coordinates 122, 311. Moving the character now with a controller will freeze the game.  It doesnt seem to happen when using the keyboard. Not sure if this needs to be fixed as the character shouldn't be clipping anyway, but thought i'd let you know.  

This is happening for me as well

If I set a high speed in the corner, the game freezes

I'll take a look!

Okay, I don't see the same issue.  Define "high speed", which corner, basic or advanced, which controller method?

I have the same problem. Apparently with the latest updates, the script does not work as before, even with the compability mod

Everything seems to be working for me.  What exactly are you experiencing?

(2 edits)

I Use tile collision I sometimes get stuck and there is a chance that the game will freeze. https://images-ext-1.discordapp.net/external/UZFVf_tk6sHPgHBiysILtOfV_U55eM_uQWI...

https://i.imgur.com/dK3MrFp.png

Yeah, using "tile collision" is a VERY important piece of information when reporting an issue :D

(4 edits)

Sorry) I can send you the project itself. There is your code without edits. I don't know how to explain the problem to you. All I can see is that in the junction of tiles, the player sometimes gets stuck in a collision, and when doing so, there is a chance that the game will freeze.

Or maybe it would be more correct that you send your working version with a tile collision, and I will try to find the problem. Maybe I did something wrong. although I have tried several times.

Oh, yeah.  If you drop the player on a wall, it's likely not gonna move.  Seems to happen to me for both keyboard and controller... because the player is stuck in the wall you dropped them on.
This is something you can solve with a "get out of the wall" function easily enough, and not really something I plan on fixing as part of this package.

Just wondering if you tried my method of moving the character to 122, 311 in the rmBasicDemo room? I can send you a copy if youre getting different results. For me the issue is that the game freezes in corners and I cant push them out of the wall.  However if the character is completely in a wall, the game wont freeze and they can be pushed out.

Yeah, I tried that exactly location in the room and it just doesn't work at all with keyboard or controller because the player is embedded in the wall from the start.  If you wanna send me a link to your example, I'd take a look

(2 edits)

Here is an example file with the character slightly overlapping a corner. At the start of the game, use a gamepad and it will freeze.  Using a keyboard I can walk out of the corner.  If the character starts more inside of the solid, it wont freeze.  

Here is a video showing the freeze.  First part is keyboard movemet, second is gamepad.  I added a timer just to help with the visualization.

Thanks for taking a look

So, check out this tweet:
https://twitter.com/Pixelated_Pope/status/1516815617109635073?s=20&t=VWha6dl9I8t...

Just call that function in your step event before movement_and_collision (or after or both, honestly) and you'll never get stuck in a wall and freeze the game ever again

(1 edit)

Hi Pixelated Pope, 
really nice script.
I got just one problem with enemies.
When they touch obstacles, the game does freeze.

As direction variable for enemies I did use
move_dir = image_angle

Thanks in advance for any suggestion.

Yeah, don't use image angle.  You need a different variable for your sprite angle, and then you draw the sprite using draw_sprite_ext with that angle variable.
image_angle rotates your collision mask, which is usually a very bad idea

Hello! You have made a great script, man. The movement is very smooth, the code itself is quite minimal and performant. Very well done. I bought this and have been using it for a few days, great job!

I have one complaint/question though. When using your script to move my objects, I don't get any collisions events firing at all. Digging around your script I'm guessing it's because you move the object out of collisions before GMS registers anything?

If I'm doing something wrong, can you please give me a pointer?
And if it's a missing feature, would it be a lot of trouble to ask you to please add it?


Thank you for your time!

Yeah, no collision events will fire.  Collision events fire if you are inside an object between the step event and the end step event, and the purpose of this script is to not be inside an object by the end of the script.

Now the script returns true or false based on whether the object's movement has been halted by an object... that may not be useful to you depending on your situation, but there's almost always a way to do what you want without using collision events.

For the record: I never use collision events past the prototyping stage 99% of the time, and even then only in the most basic, simple of situations for objects that the player can walk through.

For help with your specific situation, it's probably best to head over to the discord server.  Much easier to get live help there to get you fixed up and moving forward sooner. https://discord.gg/gamemaker

this is amazing. i see this is for statick objects. can this be applied to moving objects? like a basic enemy that moves? as a inheritance from parent to child i mean thx for your answer. love your content btw keep it up 

Please update to 2.3+ version. I catch some bug...https://disk.yandex.ru/i/hIS0fg1_bBKJcw

Thank you! I will look into it.

So, I can't seem to reproduce this on my end.  All you did was convert it to 2.3 and it just doesn't work?  What platform are you running this on?

Yes. v2.3.4.583

Well, I rewrote like the whole demo.  Try the latest upload.

TDMC.yyz

Script: movement_and_collision at line 8 : unexpected symbol "?" in expression

Script: movement_and_collision at line 8 : got '?' expected ':'

I apologize for my stupidity...

I'm afraid to break something in the script

(+1)

Update to the latest version of GM
Line 8 uses the ?? operator or "nullish" operator.  It's the equivalent of:
if(_count != undefined)
  _count = _count
else
  _count = 1

Love this as a beginning step, especially since I'm not really a coder but want to make a quick and dirty prototype of a game idea I have. Collision is so silky smooth!

What I'd really like to do is add a zaxis for jumping though, like on top of walls, and having depth collision. Any plans to update this with that? Or do you know a quick copy and paste I could do? Like I said... not much of a coder. I THINK I might be able to figure it out, maybe just adding Z whereever you call to check X and Y? It's just going to take me a very long time.

So this is something I've been meaning to write an article about, but think about it like this.

When we say "place_meeting()" we are basically asking "is there a collision here or not."  And then we handle the result of that.  "There is something there?  I can't move."  "There isn't?  I can move."

So all you really want to do is add another variable to the check: z.  
So replace place_meeting() with place_meeting_z: a script of your own making, that accepts a z axis and makes all the necessary checks; including a z-axis.  The result is still the same: there is something there, or there isn't. True or False.

This is the difference between "collision checking" and "collision handling".  You simply want to change how your collision checking is done, which is the easier part to handle.  

I HAVE done this before, so if you run into trouble, I'd recommend asking about it in the help channels of the GM Discord.  You are welcome to ping me when you ask, but if I'm unavailable someone just as capable (or more so) should be able to help.
Here's an invite.
https://discord.gg/gamemaker

Deleted 1 year ago

Hmm...  It's certainly possible to modify it to do that, but it may not be easy.  If you want to discuss it further, Discord might be a better format for talking through your options.  If you aren't already a member, join the GM Discord server, then you can either ping me in an available help channel, or DM me.

https://discord.gg/gamemaker

Bought the script I'm really new to this but needed to get some quick guidance. As I added the script but not 100% sure if I have to change anything once I add it to the object.

Best place to get help with anything GM related is in the unofficial discord server: https://discord.gg/gamemaker

If I'm there and available, I'll be happy to assist you personally, if I'm not, there are tons of awesome people who can help you with getting this script up and running and just about anything else you need help with on your game dev journey!

god the collision feel so much better now

I want to ask, is your "any speed" solution resisted to flickering? Lets say if I use 2.27 speed will my character flicker on the screen?

If they do, let me know... because they shouldn't.  There is the possibility of some jittering when sliding across a wall at a speed like 1.25 but that also depends on a lot of factors.  But your character should never "flicker", and if it does it is very unlikely to be my script that is the cause.

This script is fantastic! Works perfectly for my project and after a little fine-tuning I have better movement than ever!

I'm struggling to implement this into an asteroid-like game that uses motion_add for movement based on image rotation/angle because the script's _mv_spd expects an integer but I add movement simultaneously to direction and speed. If I separate the values, then speed increases exponentially regardless of direction... but I only want +/- speed in the player object's direction of movement.


Any help would be greatly appreciated!

Ship Create

vardirection=direction;
varspeed=speed;

Ship Step Event

//Movement Script

movement_and_collision(vardirection,varspeed,obj_wall_base);

//Add movement in direction

if (keyboard_check(vk_left) or keyboard_check(ord("A")))
{
sprite_index = spr_shipa;
vardirection=image_angle+90;
varspeed+=1;

}

if (keyboard_check(vk_right) or keyboard_check(ord("D")))
{
sprite_index = spr_shipd;
vardirection=image_angle-90;
varspeed+=1;

}

if (keyboard_check(vk_up) or keyboard_check(ord("W")))
{
sprite_index = spr_shipw;
vardirection=image_angle;
varspeed+=1;

}

if (keyboard_check(vk_up) or keyboard_check(ord("W")))
{
sprite_index = spr_shipw;
vardirection=image_angle;
varspeed+=1;

}

I don't see motion add in here, but essentially what you want to do is keep track of your horizontal speed and vertical speed separately.  And then use point_direction(0,0,hsp, vsp) to turn that into a direction, and point_distance(0,0,hsp,vsp) to turn it into a speed to pass to the script. I also recommend not using image_angle, as this will also rotate your collision mask which could cause problems.  Create a new variable to handle the display of a rotated sprite and draw the sprite in the draw event using draw_sprite_ext() with this new variable substituted for image_angle.  

I had a question regarding whether or not this was intended behavior? It seems as if the player collision mask overlaps the wall objects?

https://imgur.com/a/UqqAF7u

I wouldn't say it's "intended" behavior, but it is acceptable behavior.  The player would never see the mask, so they wouldn't know anything is wrong.  At most it would overlap by a pixel or two, and as long as it's not causing any shaking or jittering, it should be fine.

This essentially happens because we are using a larger app surface than our view, meaning that the difference between the coordinate positions of 4.0, 4.25, and 4.5 is actually visible.  So the player's y value is something like 4.25 which wouldn't fire off a "collision" (as place_meeting uses rounded values only) but we can still render the difference between 4.0 and 4.25 on screen.

Cool, appreciate the reply. I thought I was going crazy for a second, lol

Love the script but I have an issue now. I used to check "speed" for certain things (not set) but now none of that code works. Is there another way to check the player speed so I can fix this? Thanks

One way could be to do this:
pos = {x:x, y:y}
movement_and_collision(blah blah blah)
spd = point_distance(x,y,pos.x,pos.y)

Thanks! Everything working great :]

Viewing most recent comments 1 to 23 of 43 · Next page · Last page