Infinite Car Loop

JIAD

Warper
Member
Joined
Sep 1, 2016
Messages
3
Reaction score
0
First Language
English
Primarily Uses
Hello everyone, I don't know if here it's be the most suitable place to exhibit this doubt.
 







I wonder how I can create an endless loop of cars moving on a road,
My road has 150 tiles and it goes on one single direction without any turns.
Do I have to create an event "move left" 150 times +  "transparent ON"  + "move right" 150 times + "transparent OFF" and repeat the process? 
Or can I program so it goes left until it can't go any further and transfer it to the starting point?

Someone who has had the same problem and has been able to solve?

:D  Thank you  :D
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
you probably mean that your road has 150 tiles, not 150 pixels.


There are several ways to handle this, but the easiest is probably to make the move left 150 times and then use a "set position" to get back to the start.


If you make a repeating move left only, then you would need a parallel process for checking the position of the car and setting the position back once its at the end.


That would be more effective, but it is also more difficult to set up correctly.
 

JIAD

Warper
Member
Joined
Sep 1, 2016
Messages
3
Reaction score
0
First Language
English
Primarily Uses
you probably mean that your road has 150 tiles, not 150 pixels.


There are several ways to handle this, but the easiest is probably to make the move left 150 times and then use a "set position" to get back to the start.


If you make a repeating move left only, then you would need a parallel process for checking the position of the car and setting the position back once its at the end.


That would be more effective, but it is also more difficult to set up correctly.
Thank you very much
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
Let an Event use Eventcommand Set Move route, choose a EventID that will be a car and do the following


Move Right


Scriptsnippet: if $game_map.events[@id].x == ($game_map.width - 1) ; moveto(6 , 10) ; end


Explanation:


$game_map.events[@id].x  = Map X of this Event


($game_map.width - 1) = Map width 18-1 = 17 or whatever size your map got.


moveto(6 , 10) = Teleport this Event to mapx, mapy. there was also a command to teleport it back to its origins.


But your event would not move totally fluid, thats why i would recoment to make the condition if car is at mapend in another paralell event and not in the autonomous moveroute. But test for yourself. If you enter


move right than scriptline, 4 times or more the event moves a little more fluid cause of preloading or whatever :).
 
Last edited by a moderator:

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
I think that having it Move 150x will basically cause it to eventually move too far away from the screen and therefore stop moving (not 100% sure but I believe RPG Maker does stop events from moving once they're about 20 tiles away from the screen), meaning that it will never reset unless you have the player follow the car.  These kinds of things work well in confined spaces, not so much in wide spaces.


The best way to handle it in a wide space would probably be to have the game detect when the car is offscreen and reset the car to a place just to the right of the screen at that point.  This requires intermediate to advanced coding so I won't go into it here, but if it's something that you absolutely need to do for your game, you should learn about it in the "Learning JavaScript" subforum.
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
If the Moveroute is given once by an Event to an Event , the Event will continue driving around even if far away from visible Screen.


Some Anti-Lag Scripts may prevent this but have there own Workarounds to archieve the wanted.


A 150 Steps Moveroute would crash i asume, if i remember correct about old Forum topics, but iam not total sure.


This Topic is interesting playing around with Cars is fun, no matter if Lego, Match Box or RPG Maker pixel Cars :).


The hardest part in my Opinion is to let the Car driving outside of the Screen, because without Workaround like 1 Black row of black


Maptiles on above (Star Passability) at the Mapends, i dont know any other Way to make it driving outside the Mapend without just turning invisible at Mapend.


Sorry my english aint the best.
 
Last edited by a moderator:

JIAD

Warper
Member
Joined
Sep 1, 2016
Messages
3
Reaction score
0
First Language
English
Primarily Uses
Is there anyway to create the event to appear only on the screen, so the lenght of the 150 tiles event won't crash. The car event would disappear when it would be like 4 tiles on the left on the screen and then be moved to 4 tiles away to the right so it would move through the screen again??


Thanks
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
Maybe someone else can help you or Links you a final solution.


I cant,


because my english aint the best and i cant translate and bring to meaningfull context, less than half of your last post.


And me asking you stupid question for every detail, nah i thought ^^ let the Profis handle the Help this Time. Good Luck
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,070
Members
137,577
Latest member
SadaSoda
Top