The car needs to go from left to right, then go past the map's end and restart at the beginning.
I set a custom move route, then turned on a switch. Then on the next page, I made the car disappear.
Problem is, when the car reaches the end, it doesn't go entirely through the map and just disappears.
And I'm not sure how to restart the car with a new car (by random).
You don't want the car to disappear afterwards - what you want to do is to simply move the event back to the starting point, and let it start the drive anew.
If you want the car to be replaced by a different car at random, when it reaches the end of its path, turn it invisible, randomize a variable (say 1-8), and set a different graphic for each value of the variable, change the event's graphic with a simple conditional branch, move the event to the start of the path again, and make it visible.
Did that make sense? 🙂
Thanks man!
I'm abit unsure how to do this part: "You don't want the car to disappear afterwards - what you want to do is to simply move the event back to the starting point, and let it start the drive anew."
Like, when the car reaches the end of the map, it will just disappear before it leaves the map. You know, like the car is in smooth motion, then when half of the car is out of the map, it just disappears abruptly.
what is the size of the car sprite? the maps are based on a 32x32 grid, and if an event disappears when part of it is invisible, that means the invisible part was probably outside the 32x32.
And basically you cannot move an event outside the map, you'll either have to make the map larger so that the event only moves outside the player's visible area but not outside the map, or you'll have to make half a dozen partial sprites and command them to replace the original sprite to make it only look like the event leaves the map.
The first variant is much easier, you just have to make sure the player can never move to the map edge.
That is because you allowed the player to move to the end of the map, and I wasn't talking about transparent tiles.
I was talking about continuing the street beyond the part where the player is allowed to walk, so that the car can move farther on the road than the player can see.
Yes, that means you have to forbid the player to move on the road - something you should do anyway because the player will block car movement when moving on the road.
Have a single event page. Add an Autonomous Move Route and set it to Custom.
In the move route, do this:
Move RightScript: moveto(0, @y) if @x == $game_map.width - 1This assumes you only want it to move from left to right, and there aren't any corners that can be turned.Also, if your map is much bigger than the window, the built-in anti-lag will stop events from moving if they're out of range. If the car in front is out of range and no longer moves, the car behind it won't be able to move onto its tile, so it will stall as well, as will any other cards behind it.
This will not stop it disappearing abruptly - the only way to do that is to ensure there's at least one tile on the right and one on the left that the player will never be able to see - you'd do this by putting some kind of barrier up to restrict how far the player can move to the left and right, and making sure the map extends to just beyond the area visible to the player. Or use smaller sprites that are only a tile wide/high.
Thanks very much guys!
Got it. You guys are the best.