Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Collision

A topic by tapcodia created Feb 13, 2021 Views: 290 Replies: 5
Viewing posts 1 to 2

I'm new to GameMaker. Instead of using floorcolor switches i want to use collision events but they don't seem to work. I select objPlayer, and collision event with objSpring, and for the code i use the code from the switch like this:

vsp = jmpspd*1.5;
y += jmpspd*1.5;
djump = DJA;
free = 1;
xstretch= .2; 
ystretch= 3;
with(floorblock) {xscale = 2;}

I also tried the same thing except checking for collisions with the spike.  Its like the player never collides with it.

Developer (1 edit)

Indeed! The player never collides with anything. As you will find while you gain more knowledge, you generally want to prevent collisions rather than detect them and then fix them. You will have to use a floorcolor switch or write your own collision in the step event using place_meeting(x,y+1,objectocheckfor) {}. Good luck!

Thank you, place_meeting is exactly what i was looking for. One more questiom, my hero, when he goes left the image isn't flipped. Also there are 4 frames for the sprite but it only shows the first. In my other test projects i was able to get it to work fine but it doens't in your engine. Can you help?????

Developer

I think you are probably not using the correct code to draw the player. Try checking out draw_sprite_ext in the draw event of the player and input the correct arguments there.

Ah, i had it set to always draw frame 1. That's fixed, but how do i flip the images if i am moving left?

Developer

Use the dflip or flip variable as the image_xscale.