Rotated Rectangle Collision Checking Made Simple - GMS1 & GMS2 Compatible

Поделиться
HTML-код
  • Опубликовано: 17 дек 2024
  • ИгрыИгры

Комментарии •

  • @PixelatedPope
    @PixelatedPope  5 лет назад +21

    UPDATE:
    A change was made in GMS2 that fixes the bug I was apparently relying on. I thought it was weird that I only needed to increase the height of the sensor sprite... now you need to increase both. The GMS2 project file has been updated with a 60x60 sprite, and the included script has been updated as well.
    Additionally, there is a specific mask type for this now. So instead of using precise, use the rotated rectangle mask type.

    • @BlastTheBat
      @BlastTheBat 5 лет назад +1

      Now if only there was a way to visualize rotated rect collision masks.

  • @darrienscott3361
    @darrienscott3361 7 лет назад +2

    Really like your content , been finding your tutorials invaluable: your topics are specific but applicable and in depth but manageable. Wish you all the best in your endeavors!

    • @PixelatedPope
      @PixelatedPope  7 лет назад +1

      Thank you! I always try to keep things generic and applicable to as many different types of projects as possible. Thanks for watching!

  • @moonrabbit3435
    @moonrabbit3435 7 лет назад +11

    You are the best, man.

  • @mahmoud.zayedd
    @mahmoud.zayedd 6 лет назад +1

    Please come back soon :'( .

  • @raylolpez
    @raylolpez 6 лет назад

    This is FREAKIN AWESOME. And I'm totally gonna test out having a thousand lasers on screen at once lol. Quick note though! I downloaded the example project and I noticed that in the script it uses argument[0], argument[1], etc., but I actually prefer using argument0, argument1, etc., in this case since the arguments are all mandatory. If you use the brackets and forget to enter any arguments, GMS won't tell you until you try to run your game and get an error. Of course this is a matter of preference, especially if you get annoyed by GMS reminding you about missing script arguments. But just for anyone who may not know. Anyway welcome back to youtube pope :D

  • @ragintombo
    @ragintombo 2 года назад

    Thanks, still works great! Had some wider curved conveyor belts I used it on.

  • @nutsquirrel84
    @nutsquirrel84 6 лет назад

    oh that movement controls helped a lot i wasnt looking for them when i came here but appreciated man :D i started 2 days ago to gms2 after leaving unity. that was so complicated for my first game :D thanks a lot for tutorials.

  • @mahmoud.zayedd
    @mahmoud.zayedd 7 лет назад

    Great tutorial see it more than one time , you are so different than the other on RUclips you safe me every time I am struggle with something or cannot figure how It done , I am Bretty sure you are an expert not just in game maker but as computer scientist and programmer Thanks for sharing your knowledge with Us . ^_^

  • @conner1832
    @conner1832 6 лет назад +4

    Where have you gone? :(

  • @Metacious
    @Metacious 7 лет назад +2

    The more point_direction, point_distance, lengthdir_X and lengthdir_Y I use the more I need to understand trigonometry and the return value they... return.
    I would pay for some classes related to maths (even if I checked some free youtube channels, I do value your expertise)
    Thanks for the video :D

    • @PixelatedPope
      @PixelatedPope  7 лет назад +1

      Shaun Spalding has a great vid on lengthdir_x and lengthdir_y (it's super short, too) so check that out. But, yeah, point direction and point_distance is just pure trig/algebra. Honestly, I just know how to use it. I've forgotten most of high school math. I sorta wish my teacher had said "Okay, class, pay attention. This lesson will be very important in game development" XD

  • @dylan6801
    @dylan6801 7 лет назад +4

    Good tutorial, also gm studio 2 looks so nice.

    • @PixelatedPope
      @PixelatedPope  7 лет назад

      It's pretty cool. Still getting used to it, but I'm excited for the future of GM!

  • @gms2378
    @gms2378 7 лет назад +2

    Wonderful!
    *asking for more*

  • @mahmoud.zayedd
    @mahmoud.zayedd 7 лет назад

    like every time you surprise me .

  • @MiguelAngelValdepenaDelgado
    @MiguelAngelValdepenaDelgado Год назад

    thank you so much !!! eres increible espero ver mas en GM1.4 please , please yes yes ....

  • @NeZversSounds
    @NeZversSounds 6 лет назад

    I have a tricky problem - GTA1 or 2 style top-down car that has rectangle collision mask. Everything goes good as long I'm not colliding with solid object AND turning at the same time.
    I have my own "movement physics" translating car angle, speed, momentum and stuff into hspd and vspd (so no using built in speed and direction and I could use traditional collision check), but rotation freezes while loop since it doesn't have hspd or vspd to reduce but collision mask is colliding.
    Replaying GTA2 shows how amazing collision it has - car is sliding against the wall and straightens to movement direction.

    • @PixelatedPope
      @PixelatedPope  6 лет назад

      Hmm... Because rotation is a factor, you can't just ignore it when doing collision checking. You'll need to rotate the object left and right to see if it can escape any walls it may be colliding with. RUclips isn't the greatest platform for code troubleshooting. You should join my Gamemaker Discord Server. Even if I'm not there to help you personally, certainly someone will be able to help you figure this out and get it working the way you need. Here's an invite link: discord.gg/8mHW8t

    • @PixelatedPope
      @PixelatedPope  5 лет назад

      ​@PussyDestroyer​This isn't the best forum for asking coding questions. I recommend you join my discord server! Lots of people there who can answer pretty much any programming question you might have (and if I'm available I'll help personally). Join Here:
      discord.gg/By6u9pC

  • @CoffeeAI201
    @CoffeeAI201 3 года назад

    Can the rectangle collision sensor be set to scale its length based on collisions? Like if a laser collided with a wall and stopped at that precise collision point instead of overlapping?

    • @PixelatedPope
      @PixelatedPope  3 года назад

      The sensor itself, probably not... at least not easily. But you could use this collision line to determine how long it could be by using a binary search tree and rechecking the collision until you find the exact length.

    • @CoffeeAI201
      @CoffeeAI201 3 года назад

      @@PixelatedPope okay thank you

  • @sparrowpatch
    @sparrowpatch 4 года назад

    Super helpful, thank you!

  • @ericjames8765
    @ericjames8765 7 лет назад

    dude... great content! please keep it up!

  • @anonymoususer1932
    @anonymoususer1932 6 лет назад +1

    Is there a DLL for GMS1 for the function get_save_filename and load?

    • @PixelatedPope
      @PixelatedPope  6 лет назад +1

      Uhh. It's the same thing in GMS1, but only works for Windows.
      docs.yoyogames.com/source/dadiospice/002_reference/file%20handling/file%20system/get_save_filename.html

    • @anonymoususer1932
      @anonymoususer1932 6 лет назад

      +PixelatedPope Thanks for replying everything works.

  • @MisterRandomEncounter
    @MisterRandomEncounter 5 лет назад

    I wonder could this be used for Ramps or moving objects ( like floating angled platforms)

    • @PixelatedPope
      @PixelatedPope  5 лет назад

      I mean, sure? An update in GMS2 added a rotated rectangle collision mask type that you could always use for platforms. The real trick would be in the collision detection side of things.

  • @Kyun9432
    @Kyun9432 7 лет назад

    Thats pretty helpful with my lazers. except,how would you make a lazer that does not have an end point? like in no time to explain, the lazer would stop at a wall or something.
    In my case, there are several lazer turrets in a room that are shooting at me.
    also for another tutorial subject, making AI? or pathfinding?

    • @PixelatedPope
      @PixelatedPope  7 лет назад

      Well, "infinity" is a scary concept, but I'll assume you mean "very long range". Give it a length of 10000 or whatever, something that will guarantee it will be off your screen if unblocked. You can then check for collisions with something, and while you are colliding, reduce the length until you aren't. Doing that with just a while loop could be a little slow... so you'll need to do some optimizations from then, but the concept is pretty basic.

    • @PixelatedPope
      @PixelatedPope  7 лет назад +1

      I've been thinking about doing a topic on AI state machines and I may touch on path finding in that. Thanks for watching!

  • @lucasrab69
    @lucasrab69 7 лет назад +5

    why dont you just make the collision sprite 1x1 pixels, it would get rid of a lot of problems wouldnt it?

    • @GLRaema
      @GLRaema 7 лет назад +8

      If you make it 1x1 then the origin of that sprite is in the top left corner. That means all scaling and rotating happens around that corner which is not really useful for cases like this.

    • @PixelatedPope
      @PixelatedPope  7 лет назад +3

      Download the example project and try it :D

  • @Youtuber90sdude
    @Youtuber90sdude 7 лет назад

    Do you have a video/code for lifting up objects(bombs) like in Zelda? To throw items that do damage.

    • @PixelatedPope
      @PixelatedPope  7 лет назад

      Not really. That's a bit specific for the type of tutorials I like to do: but the basic concept would be to use a finite state machine that can target an object and "lift it", and while in the "carried" state, you could press another button to throw it. It would be up to the bomb object to know when to explode and deal damage. Or if it was a pot it would need to know it hit the ground and should shatter and spawn a rupee or a heart.

    • @Youtuber90sdude
      @Youtuber90sdude 7 лет назад

      PixelatedPope
      lol I had to try. Thanks for replying. What if I wanted to pick up items and throw to do damage like a rock?

    • @PixelatedPope
      @PixelatedPope  7 лет назад

      Same thing. If it's not the same thing, you've done it wrong.

    • @Youtuber90sdude
      @Youtuber90sdude 7 лет назад

      PixelatedPope do you have any videos you recommend I watch on this subject? I appreciate the feedback.

    • @PixelatedPope
      @PixelatedPope  7 лет назад

      Finite state machines?
      ruclips.net/video/-0bckaBj__M/видео.html
      ruclips.net/video/c3Yp7ZF4rQ0/видео.html

  • @oj7046
    @oj7046 7 лет назад +1

    Hello. I was wondering if you understood what an indie developer would do after such a developer had a game or a demo of a game completed to publish the game. I feel like it's more than uploading a file to a digital distribution site like Steam besides spreading the word about the game.

    • @PixelatedPope
      @PixelatedPope  7 лет назад +2

      Sorry, that's not really a topic I've got much knowledge on. Never actually "published" a game beyond a simple Android app. It might be a good question for the guys on the GameDev subreddit.

    • @oj7046
      @oj7046 7 лет назад

      Oh okay thank you anyways.

  • @lewisshere331
    @lewisshere331 6 лет назад

    Where did he go?

    • @PixelatedPope
      @PixelatedPope  6 лет назад +1

      Discord! discord.gg/vwqQxfP
      Not sure how many more videos I'll be making in the future... planning on doing an update vid of sorts, but just haven't had the time lately.

    • @lewisshere331
      @lewisshere331 6 лет назад

      okay just wondering, ur one of my favorite game making channels and I was wondering if u were okay

  • @JWG.LLC_The_Artist
    @JWG.LLC_The_Artist 6 лет назад

    Please pin ball tutorial or at least the flippers or paddles or whatever you want to call them

  • @DrBananananananananananananana
    @DrBananananananananananananana 2 месяца назад

    More like BROtated rectangle collisions