Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
I have this issue with the imagemap: it is literally a map, and has a number of visitable points. The one you are currently at is marked by a little ship icon, and clicking on any adjacent point is updating some game data and moving the icon. However, the ship is moved instantaneously, while I'd like it to travel for half a second or so. How do I make it so?
screen map_screen():
tag map
modal True
zorder 2
if gl_no_rollback:
$ renpy.block_rollback()
imagemap:
auto 'images/1024map_%s.png'
hotspot monet.hotspot action Travel(monet)
hotspot tartari.hotspot action Travel(tartari)
#
#More nodes here in no particular order
#They are exactly the same
#
hotspot node7.hotspot action Travel(node7)
add 'images/1024ship.png':
anchor (0.5, 1.0)
pos current_port.coordinates
id 'ship'
Thanks philat, I got this working (although I had to write a transform that takes into account both old and new coordinates), but stumbled into the next problem. My code (in Travel action) hides map screen after ship coordinates have been updated, so the transform is actually shown only when the screen is shown for the next time, which is weird. The player travels to a location, reads whatever happens there, departs and only after that his ship does finally arrive.
I have tried adding renpy.redraw(ship, 0), renpy.restart_interaction(), calling update() on ship Transform, and renpy.force_full_redraw() to the __call__ method, but it does not help. Neither does adding pause and hide screen statement to the location start label instead of the method (with or without on hide clause in transform). How do I make screen hiding wait until the transform has finished?
No idea if this is the best way to get this done, but showing a separate blank screen with a timer and calling renpy.retart_interaction() works for me in a little test game. You can then hide both screens in the label that is jumped to or in the timer screen, I think.
The following code is to illustrate the concept only; I stripped your stuff down to a bare minimum for testing purposes, but you can probably use this as a springboard for your own stuff.
Thank you, I've got it working. There are a few details I had to adjust (like throw Hide actions to timer screen and fiddling with coordinate variables), but overall idea is great.