Pac-Man Movements

Q

Qing Donnie Yoshi

Guest
No, I just mean it's showing he took the downward path; 90's not an available option because he can't move backwards.

All that matters is that readout shows all the ghosts should be working fine -- they're detecting paths and supposedly taking them. It also shows Blinky getting stuck somewhere for some reason.

If you want, upload a .YYZ of your project to some file hosting site and I can take a look at it, because everything's working fine on my end.
Oh the cause of him getting stuck was actually the opening that I haven't closed up during that. I closed it though so he shouldn't be getting stuck anymore. but shouldn't him as well as the others go left instead of right at the start?
 
Last edited by a moderator:

TheouAegis

Member
So are they all moving fine through the maze for now? As long as you start them outside the ghost house?

I need to get to bed, it's almost 3am now.
 
Q

Qing Donnie Yoshi

Guest
So are they all moving fine through the maze for now? As long as you start them outside the ghost house?

I need to get to bed, it's almost 3am now.
Yes they are, also it's 6am for me rn so I pretty much missed all night of sleep. Good Night though.
 
Q

Qing Donnie Yoshi

Guest
OK so I've made some changes to the room and decided to make boarders for 'em. Now the problem is that I have to change the warping size considering the sides of the room has been expanded. Any ideas on how to do so? Here's a picture of the room rn.
 

Attachments

TheouAegis

Member
You can't use move_wrap() now. Make the border a foreground and put some black so that Pac-man and the ghosts will still look like they are moving off the screen when nearing the edge. Find your left edge of the maze and make a note what the x coordinate is. Then find the right edge of the maze and make a note of the x coordinate. Now in the End Step events of Pacman and Blinky, check if bbox_left is greater than the right side; if it is, set x to the left side minus grid. If bbox_right is less than the left side, set x to the right side plus grid.

Code:
if bbox_left=>maze_right x=maze_left-grid;
else
if bbox_right<=maze_left x=maze_right+grid;
 
Q

Qing Donnie Yoshi

Guest
You can't use move_wrap() now. Make the border a foreground and put some black so that Pac-man and the ghosts will still look like they are moving off the screen when nearing the edge. Find your left edge of the maze and make a note what the x coordinate is. Then find the right edge of the maze and make a note of the x coordinate. Now in the End Step events of Pacman and Blinky, check if bbox_left is greater than the right side; if it is, set x to the left side minus grid. If bbox_right is less than the left side, set x to the right side plus grid.

Code:
if bbox_left=>maze_right x=maze_left-grid;
else
if bbox_right<=maze_left x=maze_right+grid;
So wait I’m a little confused. I have the x coordinations for both left and right side but how do I f
You can't use move_wrap() now. Make the border a foreground and put some black so that Pac-man and the ghosts will still look like they are moving off the screen when nearing the edge. Find your left edge of the maze and make a note what the x coordinate is. Then find the right edge of the maze and make a note of the x coordinate. Now in the End Step events of Pacman and Blinky, check if bbox_left is greater than the right side; if it is, set x to the left side minus grid. If bbox_right is less than the left side, set x to the right side plus grid.

Code:
if bbox_left=>maze_right x=maze_left-grid;
else
if bbox_right<=maze_left x=maze_right+grid;
OK the code work though I had to remove the first pair of “=“ right behind box_left and box_right. Now I gotta fix the movements for Pac-Man and the Ghosts since I’ve changed the room size and contents.
 
Q

Qing Donnie Yoshi

Guest
So wait I’m a little confused. I have the x coordinations for both left and right side but how do I f

OK the code work though I had to remove the first pair of “=“ right behind box_left and box_right. Now I gotta fix the movements for Pac-Man and the Ghosts since I’ve changed the room size and contents.
Ok so I’ve fixed the problem, the maze wasn’t aligned properly to the grid so after fixing that Pac and the Ghosts can now move again but now the warping thing is busted. After I fixed the alignment I relocated the spots for the warping but now both Pac and the ghosts get stuck in said coordinates. The coordinates are even numbers too. Can’t I make an object that can act as a teleporter?
 

TheouAegis

Member
Try offsetting Pac-man after he jumps.
Code:
if bbox_left>maze_right x=maze_left-grid+2;
else
if bbox_right<maze_left x=maze_right+grid-2;
You could use a teleporter object. It's not the proper way to do it, but you could do it.
 
Q

Qing Donnie Yoshi

Guest
Try offsetting Pac-man after he jumps.
Code:
if bbox_left>maze_right x=maze_left-grid+2;
else
if bbox_right<maze_left x=maze_right+grid-2;
You could use a teleporter object. It's not the proper way to do it, but you could do it.
Nope it still didn't work properly, I might just end up going with a teleporting object after all. Besides I might use it for later use anyways. Any Idea how I can do that? Ima try to find a way on my end in the mean time.
 
G

GamemakerTrialUser1

Guest
Try offsetting Pac-man after he jumps.
Code:
if bbox_left>maze_right x=maze_left-grid+2;
else
if bbox_right<maze_left x=maze_right+grid-2;
You could use a teleporter object. It's not the proper way to do it, but you could do it.
Not related to what's quoted.

TL/DR - I want the player object to move endlessy after pressing a direction key once - cause lazyness is bliss :p

Not to worry a good night's sleep was all I needed. Figured it out. So easy :facepalm:

This is a good thread on the subject of Pacman.

TheouAegis you're a very good patient teacher. Qing Donny Yoshi is lucky to have had your guidance and help.
 
Last edited by a moderator:
Q

Qing Donnie Yoshi

Guest
Try offsetting Pac-man after he jumps.
Code:
if bbox_left>maze_right x=maze_left-grid+2;
else
if bbox_right<maze_left x=maze_right+grid-2;
You could use a teleporter object. It's not the proper way to do it, but you could do it.
OK I've returned from silence, and i have fixed the problem.
 
Q

Qing Donnie Yoshi

Guest
The way I fixed it I swapped

if bbox_left>maze_right x=maze_left-grid+2;
else
if bbox_right<maze_left x=maze_right+grid-2;

with

if bbox_left > maze_right x=maze_left + grid;
else
if bbox_right < maze_left x=maze_right - grid + 2;
 
Q

Qing Donnie Yoshi

Guest
Try offsetting Pac-man after he jumps.
Code:
if bbox_left>maze_right x=maze_left-grid+2;
else
if bbox_right<maze_left x=maze_right+grid-2;
You could use a teleporter object. It's not the proper way to do it, but you could do it.
Hello I'm back. So made some tiny changes and everything seems to work perfectly rn. I believe regarding the tunnels the ghosts actually slows down. I've made an object that should do that function, what should I right down for the code?
 

TheouAegis

Member
Yeah they do slow down in the tunnel. How are you setting the speed for the ghost? Ideally you should be setting the speed of the ghost in the beginning step event. If the ghost is touching a tunnel object or whatever, set his speed to a lower value. They also slow down when you're trying to eat them. The biggest problem you are going to run into the is with how everything was set up, your speeds can pretty much only be one, two, or four. Otherwise you'll be back to having ghost Miss the turns due to rounding issues.
 

Let's Clone

Member
I wish I had finished my tutorial on this already, it would be super helpful for you. I'm done with about 90% of my PacMan game and then I just have to break it into parts for my tutorial series. It's an incredibly fun game to make! But getting the ghost behaviors done correctly can be a bit tricky.

Not sure if you've seen this before, but it's essential information for building a clone of PacMan
https://pacman.holenet.info/#CH2_Frightening_Behavior
 

Sabnock

Member
i have completed a PacMan clone and also posted the smazing PacMan dossier on here for them to use but it seems it went unnoticed by them. :)

I loved working on it. working out how the ghost move round the maze the target of pac and the scatter mode and home areas taught me a huge amount.
 

Sabnock

Member
I wish I had finished my tutorial on this already, it would be super helpful for you. I'm done with about 90% of my PacMan game and then I just have to break it into parts for my tutorial series. It's an incredibly fun game to make! But getting the ghost behaviors done correctly can be a bit tricky.

Not sure if you've seen this before, but it's essential information for building a clone of PacMan
https://pacman.holenet.info/#CH2_Frightening_Behavior
i have completed a PacMan clone and also posted the smazing PacMan dossier on here for them to use but it seems it went unnoticed by them. :)

I loved working on it. working out how the ghosts move around the maze the targeting of pac and the scatter modes and home areas taught me a huge amount.
 

Let's Clone

Member
i have completed a PacMan clone and also posted the smazing PacMan dossier on here for them to use but it seems it went unnoticed by them. :)

I loved working on it. working out how the ghost move round the maze the target of pac and the scatter mode and home areas taught me a huge amount.
It was so much fun to make! I had a blast replicating Pink's glitch when Pac's moving upwards. Obviously we could make Pinky work as intended, but it just felt right to match the behavior with the old arcade boxes haha.
 
Q

Qing Donnie Yoshi

Guest
i have completed a PacMan clone and also posted the smazing PacMan dossier on here for them to use but it seems it went unnoticed by them. :)

I loved working on it. working out how the ghost move round the maze the target of pac and the scatter mode and home areas taught me a huge amount.
Oh no your tutorials hasn’t gone unnoticed, I actually have it book marked. The thing is putting said info into coding is what I need help the most with, that’s why I’ve mainly ask Theou for help.
 
Q

Qing Donnie Yoshi

Guest
Yeah they do slow down in the tunnel. How are you setting the speed for the ghost? Ideally you should be setting the speed of the ghost in the beginning step event. If the ghost is touching a tunnel object or whatever, set his speed to a lower value. They also slow down when you're trying to eat them. The biggest problem you are going to run into the is with how everything was set up, your speeds can pretty much only be one, two, or four. Otherwise you'll be back to having ghost Miss the turns due to rounding issues.
I do have Speed in Begin Step event but I also have it in Create event as well. If I take speed out of Create will it cause a problem if I already have it in Begin Step?
 

Sabnock

Member
Oh no your tutorials hasn’t gone unnoticed, I actually have it book marked. The thing is putting said info into coding is what I need help the most with, that’s why I’ve mainly ask Theou for help.
Understood.

If you don't feel that you are a strong coder yet you should probably do a lot of tutorials and start yourself getting confident. learn about things like cell based games where you use an array for your movement, collisions and AI like the original Pac Man, ds_grids would help you also as well as looking at the small amount of trigonometry you will need to pull off the ghosts AI.
 
Q

Qing Donnie Yoshi

Guest
Yeah they do slow down in the tunnel. How are you setting the speed for the ghost? Ideally you should be setting the speed of the ghost in the beginning step event. If the ghost is touching a tunnel object or whatever, set his speed to a lower value. They also slow down when you're trying to eat them. The biggest problem you are going to run into the is with how everything was set up, your speeds can pretty much only be one, two, or four. Otherwise you'll be back to having ghost Miss the turns due to rounding issues.
OK the speed in the create event is gone and the ghosts can still function correctly. What's next?
 
Q

Qing Donnie Yoshi

Guest
Yeah they do slow down in the tunnel. How are you setting the speed for the ghost? Ideally you should be setting the speed of the ghost in the beginning step event. If the ghost is touching a tunnel object or whatever, set his speed to a lower value. They also slow down when you're trying to eat them. The biggest problem you are going to run into the is with how everything was set up, your speeds can pretty much only be one, two, or four. Otherwise you'll be back to having ghost Miss the turns due to rounding issues.
???
 

TheouAegis

Member
What's in your Begin Step Event? Are you using an object at the edge of each tunnel to slow the ghosts down, or do you want to just slow their speed based on coordinates? You're asking for a lot without showing any personal progress...
 
Q

Qing Donnie Yoshi

Guest
What's in your Begin Step Event? Are you using an object at the edge of each tunnel to slow the ghosts down, or do you want to just slow their speed based on coordinates? You're asking for a lot without showing any personal progress...
Sorry you’re I should’ve showed you something first before asking. For the begin step this is what it currently looks like:

if goHome {
targetX = 784
targetY = 496
speed = 4;
}
else
If global.PowerPellet {
targetX = 0;
targetY = 0;
speed = 0;
}
else {
targetX = obj_Player_1.x;
targetY = obj_Player_1.y;
speed = 4;
}
At some point I’m going to change the target player 1 to target nearest player once we get the AI in but that’s not the priority rn. As for the ghosts slowing down I want to go with an Object causing them to slow down because I still have the idea of them going one end of the tunnel to the other using an Object but the coordinates seem to be working fine so let’s try coordinates. Also idk if you saw but I’d fixed the TP problem by changing:


if bbox_left>maze_right x=maze_left-grid+2;
else
if bbox_right<maze_left x=maze_right+grid-2;

To

if bbox_left > maze_right x=maze_left + grid;
else
if bbox_right < maze_left x=maze_right - grid + 2;
 

TheouAegis

Member
So maze_left and maze_right are the coordinates OUTSIDE the maze, right? So the tunnel could be defined as maze_left+grid and maze_right-grid. So you could have in the Begin Step

Code:
if goHome {
     targetX = 784
     targetY = 496
     speed = 4;
}
else
if global.PowerPellet {
     targetX = 0;
     targetY = 0;
     speed = 0;
}
else {
     targetX = obj_Player_1.x;
     targetY = obj_Player_1.y;
     if x < maze_left+grid || x > maze_right-grid
         speed = 2;
     else
          speed = 4;
}

BTW you have the ghost set to speed 0 when the power pill is eaten. If Pac-Man eats a pill while a ghost is in the tunnel, it will lock the ghost in the tunnel. So if you're planning on that, you're better off setting speed to 1 when the pill is eaten so the ghost can get out of the tunnel. Or alternatively, include the tunnel speed conditional outside the other speeds, so the tunnel speed overrides all other speeds, like so:

Code:
if goHome {
     targetX = 784
     targetY = 496
     speed = 4;
}
else
if global.PowerPellet {
     targetX = 0;
     targetY = 0;
     speed = 0;
}
else {
     targetX = obj_Player_1.x;
     targetY = obj_Player_1.y;
     speed = 4;
}
if x < maze_left+grid || x > maze_right-grid
    speed = 2;
 
Q

Qing Donnie Yoshi

Guest
So maze_left and maze_right are the coordinates OUTSIDE the maze, right? So the tunnel could be defined as maze_left+grid and maze_right-grid. So you could have in the Begin Step

Code:
if goHome {
     targetX = 784
     targetY = 496
     speed = 4;
}
else
if global.PowerPellet {
     targetX = 0;
     targetY = 0;
     speed = 0;
}
else {
     targetX = obj_Player_1.x;
     targetY = obj_Player_1.y;
     if x < maze_left+grid || x > maze_right-grid
         speed = 2;
     else
          speed = 4;
}

BTW you have the ghost set to speed 0 when the power pill is eaten. If Pac-Man eats a pill while a ghost is in the tunnel, it will lock the ghost in the tunnel. So if you're planning on that, you're better off setting speed to 1 when the pill is eaten so the ghost can get out of the tunnel. Or alternatively, include the tunnel speed conditional outside the other speeds, so the tunnel speed overrides all other speeds, like so:

Code:
if goHome {
     targetX = 784
     targetY = 496
     speed = 4;
}
else
if global.PowerPellet {
     targetX = 0;
     targetY = 0;
     speed = 0;
}
else {
     targetX = obj_Player_1.x;
     targetY = obj_Player_1.y;
     speed = 4;
}
if x < maze_left+grid || x > maze_right-grid
    speed = 2;
Ok the code works via coordinates but there’s a slight problem. So I chose the coordinates that was pretty much at the start of the tunnels but because the tunnel’s length is the same size as the 4 corners of the maze the pathways where those 4 corners are also effected.this what I got down:

maze_left = 512;
maze_right = 1086;

if goHome {
targetX = 784
targetY = 496
speed = 4;
}
else
if global.PowerPellet {
targetX = 0;
targetY = 0;
speed = 2;
}
else {
targetX = obj_Player_1.x;
targetY = obj_Player_1.x;
if x < maze_left + grid || x > maze_right - grid + 2
speed = 2;
else
speed = 4;
}

I had to do the same for the Maze part and add “+ 2” to the maze_right part of the code.
 
Q

Qing Donnie Yoshi

Guest
So maze_left and maze_right are the coordinates OUTSIDE the maze, right? So the tunnel could be defined as maze_left+grid and maze_right-grid. So you could have in the Begin Step

Code:
if goHome {
     targetX = 784
     targetY = 496
     speed = 4;
}
else
if global.PowerPellet {
     targetX = 0;
     targetY = 0;
     speed = 0;
}
else {
     targetX = obj_Player_1.x;
     targetY = obj_Player_1.y;
     if x < maze_left+grid || x > maze_right-grid
         speed = 2;
     else
          speed = 4;
}

BTW you have the ghost set to speed 0 when the power pill is eaten. If Pac-Man eats a pill while a ghost is in the tunnel, it will lock the ghost in the tunnel. So if you're planning on that, you're better off setting speed to 1 when the pill is eaten so the ghost can get out of the tunnel. Or alternatively, include the tunnel speed conditional outside the other speeds, so the tunnel speed overrides all other speeds, like so:

Code:
if goHome {
     targetX = 784
     targetY = 496
     speed = 4;
}
else
if global.PowerPellet {
     targetX = 0;
     targetY = 0;
     speed = 0;
}
else {
     targetX = obj_Player_1.x;
     targetY = obj_Player_1.y;
     speed = 4;
}
if x < maze_left+grid || x > maze_right-grid
    speed = 2;
Hey did you get my last reply, also if I'm annoying you do say so.
 

TheouAegis

Member
I didn't see the last post until just now. Weird.

So the coordinate method won't work in this case. You will have to make a tunnel object and set the speed to 2 when colliding with the tunnel object. I think in the NES version of Ms. Pac-man they actually used a different tile for the tunnels -- it looked the same as any other maze wall tile, but it was actually a different tile, so the ghosts were checking if they were on a tunnel tile. You're not using tiles, so a tunnel object will have to do.

So make a tunnel object (we can just call it obj_tunnel) and make it the same size as your grid so and place one inside each of the tunnels. Then change
Code:
if x < maze_left + grid || x > maze_right - grid + 2
to
Code:
if position_meeting(x,y,obj_tunnel)
You could use place_meeting() instead of position_meeting(), but I think that would make the ghost slow down too soon.
 
Q

Qing Donnie Yoshi

Guest
I didn't see the last post until just now. Weird.

So the coordinate method won't work in this case. You will have to make a tunnel object and set the speed to 2 when colliding with the tunnel object. I think in the NES version of Ms. Pac-man they actually used a different tile for the tunnels -- it looked the same as any other maze wall tile, but it was actually a different tile, so the ghosts were checking if they were on a tunnel tile. You're not using tiles, so a tunnel object will have to do.

So make a tunnel object (we can just call it obj_tunnel) and make it the same size as your grid so and place one inside each of the tunnels. Then change
Code:
if x < maze_left + grid || x > maze_right - grid + 2
to
Code:
if position_meeting(x,y,obj_tunnel)
You could use place_meeting() instead of position_meeting(), but I think that would make the ghost slow down too soon.
OK the place meeting works wonderfully but going into the left side and out the right has the ghost not responding anymore. is it possible to add a + 2 to the code for it to work properly like with the teleporting?
 
Q

Qing Donnie Yoshi

Guest
I didn't see the last post until just now. Weird.

So the coordinate method won't work in this case. You will have to make a tunnel object and set the speed to 2 when colliding with the tunnel object. I think in the NES version of Ms. Pac-man they actually used a different tile for the tunnels -- it looked the same as any other maze wall tile, but it was actually a different tile, so the ghosts were checking if they were on a tunnel tile. You're not using tiles, so a tunnel object will have to do.

So make a tunnel object (we can just call it obj_tunnel) and make it the same size as your grid so and place one inside each of the tunnels. Then change
Code:
if x < maze_left + grid || x > maze_right - grid + 2
to
Code:
if position_meeting(x,y,obj_tunnel)
You could use place_meeting() instead of position_meeting(), but I think that would make the ghost slow down too soon.
Never mind I fixed it by saying:
Code:
if position_meeting(x + 2,y + 2,obj_Ghost_Slowdown) || position_meeting(x,y,obj_Ghost_Slowdown)
. Also I've been re-thinking and I wanna go with a teleporting object instead of using coordinates, even though they work just fine.
 
Last edited by a moderator:

TheouAegis

Member
What do you mean a teleporting object? Like have an object that when Pac-man or the ghost reaches the middle, it instantly sends Pac-man or the ghost to another instance of that object? Like

Code:
//inside teleporter's Collision With All event...

if sign(other.x-x) == sign(other.hspeed) && other.hspeed!=0 {
    other.x = myPair.x + other.hspeed;
    other.y = myPair.y;
}
else
if sign(other.y-y) == sign(other.vspeed) && other.vspeed!=0 {
    other.y = myPair.y + other.vspeed;
    other.x = myPair.x;
}
 
Q

Qing Donnie Yoshi

Guest
What do you mean a teleporting object? Like have an object that when Pac-man or the ghost reaches the middle, it instantly sends Pac-man or the ghost to another instance of that object? Like

Code:
//inside teleporter's Collision With All event...

if sign(other.x-x) == sign(other.hspeed) && other.hspeed!=0 {
    other.x = myPair.x + other.hspeed;
    other.y = myPair.y;
}
else
if sign(other.y-y) == sign(other.vspeed) && other.vspeed!=0 {
    other.y = myPair.y + other.vspeed;
    other.x = myPair.x;
}
yeah something like that. Now when you say ALL events do you mean all of Pac's and ghost's specific event like all their begin step or do you mean like every single event that they have running?
 
Q

Qing Donnie Yoshi

Guest
No, the event Collision With All
Oh OK. So with the word myPair what exactly do I do with that, do I just define it as the objects I'm gonna use for the tunnel teleporting? Because if so this is what the code looks like so far in the Tunnel teleport collision event for Pac-Man:

Code:
myPair = obj_Tunnel_Teleporter;

if sign(other.x-x) == sign(other.hspeed) && other.hspeed!=0 {
    other.x = myPair.x + other.hspeed;
    other.y = myPair.y;
}
else
if sign(other.y-y) == sign(other.vspeed) && other.vspeed!=0 {
    other.y = myPair.y + other.vspeed;
    other.x = myPair.x;
}[close/]
 
Last edited by a moderator:

TheouAegis

Member
No, myPair is a variable inside the Creation Code for each teleporterobject. It is what you use to store the ID of the other teleporter you want it to move Pac-man/ghosts to.

And in ghost's begin event, you set speed to 2 if colliding with a teleporter.
 
Q

Qing Donnie Yoshi

Guest
No, myPair is a variable inside the Creation Code for each teleporterobject. It is what you use to store the ID of the other teleporter you want it to move Pac-man/ghosts to.

And in ghost's begin event, you set speed to 2 if colliding with a teleporter.
This might be me being slow but I'm still a bit confused on how to put the code in, is it the Teleporter's collision event I put it in or pac and the ghosts?
 
Q

Qing Donnie Yoshi

Guest
No, myPair is a variable inside the Creation Code for each teleporterobject. It is what you use to store the ID of the other teleporter you want it to move Pac-man/ghosts to.

And in ghost's begin event, you set speed to 2 if colliding with a teleporter.
OK I get it now, but the result is Pac (since I'm testing it on him first) just stops right on the side of the object. Here's the screenshot of the codes for both teleporters with the Collision and create event.
 

Attachments

TheouAegis

Member
The teleporter's Create Event code -- the one that says "if sign(other.x-x)..." -- needs to be in its Collision With All (or maybe it's Collision With Any) event. You want that code to run when any instance collides with it.

Also you only need 1 teleporter object. All teleporters would use the same object. When I say you need to store the id of the target for each teleporter, I mean you get the inst_XXXXXXXX id of the teleporter instance you want to go to a d then you that that in the Creation Code for the teleporter.

e.g.,
myPair=inst_34af54c98;
 
Q

Qing Donnie Yoshi

Guest
The teleporter's Create Event code -- the one that says "if sign(other.x-x)..." -- needs to be in its Collision With All (or maybe it's Collision With Any) event. You want that code to run when any instance collides with it.

Also you only need 1 teleporter object. All teleporters would use the same object. When I say you need to store the id of the target for each teleporter, I mean you get the inst_XXXXXXXX id of the teleporter instance you want to go to a d then you that that in the Creation Code for the teleporter.

e.g.,
myPair=inst_34af54c98;
OK so the create event should look like this now right?
Code:
myPair = inst_33D2CB7F && inst_1CE6CC5A[code/]
as for the "Collision with all" I don't really see an option for that, all it says is Collision with a specific object.
 

Nidoking

Member
myPair = inst_33D2CB7F && inst_1CE6CC5A
You can't combine instance ids this way. If you want your teleporter to have multiple endpoints, you're going to have to do something completely different. You also don't want to put specific instance ids in the create event. The instruction was Creation Code, but I find it a lot easier to use the Instance Variables for that. You have to set whichever one you choose in the Room Editor.

As for the collision event, I recommend creating a parent object for all of the things that can be teleported and using the collision event for that parent. If that doesn't work, you'll have to use the individual collision event for each object type. Then you'd probably want to create a script and call that from each event, or write the event once and then use event_perform to call it from the other events.
 

TheouAegis

Member
as for the "Collision with all" I don't really see an option for that, all it says is Collision with a specific object.
Dangit, you're right. You'll have to use the Step or End Step event in the teleporter object and put that code inside a with() and reverse the "other" uses.
Code:
with all {
if hspeed != 0 && sign(x-other.x) == sign(hspeed) {
    x = other.myPair.x + hspeed;
    y = other.myPair.y;
}
else
if vspeed != 0 && sign(y-other.y) == sign(vspeed) {
    y = other.myPair.y + vspeed;
    x = other.myPair.x;
}
}
If you do make a parent object for Pac-man that is also the (grand)parent object of Blinky, you could still use the my previous code inside a Collision With the parent event.
 
Q

Qing Donnie Yoshi

Guest
Dangit, you're right. You'll have to use the Step or End Step event in the teleporter object and put that code inside a with() and reverse the "other" uses.
Code:
with all {
if hspeed != 0 && sign(x-other.x) == sign(hspeed) {
    x = other.myPair.x + hspeed;
    y = other.myPair.y;
}
else
if vspeed != 0 && sign(y-other.y) == sign(vspeed) {
    y = other.myPair.y + vspeed;
    x = other.myPair.x;
}
}
If you do make a parent object for Pac-man that is also the (grand)parent object of Blinky, you could still use the my previous code inside a Collision With the parent event.
The code didn't work so well. All it did was jumbled all the ghosts and Pac-Man together and pretty much ruined their movements.
 
Top