Questions on making image menus, changing font, animation

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.
Post Reply
Message
Author
Jukilum
Newbie
Posts: 12
Joined: Thu Feb 07, 2008 12:40 pm
Contact:

Questions on making image menus, changing font, animation

#1 Post by Jukilum »

I have a few questions that I need answered.

1. How can I make a menu where images are the options and can be on several different areas on the screen?

2. How do I change the font?

3. How can I animate a character walking toward where the player has clicked on a set path?

User avatar
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

Re: Questions on making image menus, changing font, animation

#2 Post by DaFool »

Jukilum wrote:I have a few questions that I need answered.

1. How can I make a menu where images are the options and can be on several different areas on the screen?
I'm sorry, that is actually hard to do for a non-expert. I'll let somebody else answer that.
2. How do I change the font?
Make sure you're in the same init block as the other style declarations in options.rpy

Code: Select all

        style.default.font = "nameofyourtruetypefont.ttf" 
3. How can I animate a character walking toward where the player has clicked on a set path?
Unfortunately world map features are currently not yet available.

Jukilum
Newbie
Posts: 12
Joined: Thu Feb 07, 2008 12:40 pm
Contact:

Re: Questions on making image menus, changing font, animation

#3 Post by Jukilum »

I can wait on #1.

#2, When I tried that on my last game I just edited the default line in the options, but it didn't work. Where does the font have to be located?

#3, Darn! Is there a way to at least animate on screen characters staying in one spot by using animated gifs or something?

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

Re: Questions on making image menus, changing font, animation

#4 Post by monele »

Is there a way to at least animate on screen characters staying in one spot by using animated gifs or something?
Animated GIF is not supported but as long as you can have all your frames in separate pictures (PNG or JPG depending on wether you want transparency or not), you should look into this : http://www.renpy.org/wiki/Animation
Ren'Py doesn't deal with adventure game concepts so such things will have to be done by hand ^^;

Jukilum
Newbie
Posts: 12
Joined: Thu Feb 07, 2008 12:40 pm
Contact:

Re: Questions on making image menus, changing font, animation

#5 Post by Jukilum »

K, that should work great for the animation!

Another question, how do you change the icon of your program so that it isn't just the girl with the snake?

Guest

Re: Questions on making image menus, changing font, animation

#6 Post by Guest »

Jukilum wrote: #2, When I tried that on my last game I just edited the default line in the options, but it didn't work. Where does the font have to be located?
You can download a TrueType font from places like 1001freefonts or elsewhere. Place the .ttf file in the /game folder.

monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

Re: Questions on making image menus, changing font, animation

#7 Post by monele »

You can change the icon of the game window and the icon of the EXE.
For the exe : http://www.renpy.org/wiki/renpy/doc/tut ... 27Py_Games Before Packaging -> Change Exe Icon.
For the window : http://www.renpy.org/wiki/renpy/doc/ref ... _Variables config.window_icon

herenvardo
Veteran
Posts: 359
Joined: Sat Feb 25, 2006 11:09 am
Location: Sant Cugat del Vallès (Barcelona, Spain)
Contact:

Re: Questions on making image menus, changing font, animation

#8 Post by herenvardo »

DaFool wrote:
Jukilum wrote: 3. How can I animate a character walking toward where the player has clicked on a set path?
Unfortunately world map features are currently not yet available.
I would disagree with the "currently" part of this reply. Actually, world map support is deliberatelly not supported, as confessed by PyTom himself on http://lemmasoft.renai.us/forums/viewto ... ?f=8&t=982
PyTom wrote:That Ren'Py isn't designed for RPGs doesn't help. (I've resisted adding support for a world map, for example... there are other tools more suitable for RPGs.)
However, there is hope yet... in the end, there is already an RPG written in Ren'py (Elven Relations, by Chronoluminaire), and I'm working on another one :D
Given two points, if you are able to define them as Ren'py Positions, you should be able to move something between them. If you need to move the sprite along a more complex path... well, here comes handy the fact that you can use python code to implement anything ren'py doesn't already do for you. I've not tested this yet, but even if it doesn't work properly it will at least give you an idea on how to approach the problem:

Code: Select all

def MovePath(sprite, path, time):
  # sprite is anything you could feed to a show statement, normally an image or animation
  # path is a list of positions to "visit" during the movement (like "checkpoints")
  # time is how long you want the movement to take between consecutive points in the path
  if len(path)>=2:
    i = 0
    while i+1 < len(path):
      # I'm not familiar with the show function, so I'm not too sure about this call:
      renpy.show(sprite, [Move(path[i], path[i]+1, time)])
      renpy.pause(time) # wait until moved before moving the next step
      i += 1 # Don't forget to increment the loop couter! (I always forget ^^'  )
You might want to check http://www.renpy.org/wiki/renpy.show for details about how to use the show() function (I checked, but I'm still unsure about the usage I made in the example.) Once you have the above function in a python block, you should just call it (assuming it works):

Code: Select all

$ image animation = Animation("frame_1.png", 0.25,
                                "frame_2.png", 0.25,
                                "frame_3.png", 0.25)
$ path = [(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]
$ MovePath(animation, path, 1.0) # this line does the movement
Well, I think this and a bit of testing and tinkering is all you'll need to have your sprites happilly flying across the screen, so that's all.
Isn't it? I think there is more...
No, that's all about moving and animating sprites...
Even so, there is a bit more ;) :
Jukilum wrote:1. How can I make a menu where images are the options and can be on several different areas on the screen?
Short answer: you just need to use an imagemap. Long answer: don't be lazy and click the link. The Ren'py documentation explains all you should need to use image maps and includes a simple, yet helpful, example ;).
Now, I'm really done.
I have failed to meet my deadlines so many times I'm not announcing my projects anymore. Whatever I'm working on, it'll be released when it is ready :P

Jukilum
Newbie
Posts: 12
Joined: Thu Feb 07, 2008 12:40 pm
Contact:

Re: Questions on making image menus, changing font, animation

#9 Post by Jukilum »

Thanks! I think that should do it for me! The only thing I'm still wondering about is the font. I know that I already received an answer, but when I tried that in the first game I made it didn't seem to work. Unless the default options file has a flaw, I'm still confused. On a side note, after I finished my first game and started another, when I clicked on the edit script button nothing happens. Now I have to go open the files by hand (Oh no, manual labor!) So that must be a glitch.

I read something about being able to put some of the code in different files. Could someone explain that a bit more clearly to me please?


Thanks again for all of the help I have gotten!

herenvardo
Veteran
Posts: 359
Joined: Sat Feb 25, 2006 11:09 am
Location: Sant Cugat del Vallès (Barcelona, Spain)
Contact:

Re: Questions on making image menus, changing font, animation

#10 Post by herenvardo »

Jukilum wrote:Thanks! I think that should do it for me! The only thing I'm still wondering about is the font. I know that I already received an answer, but when I tried that in the first game I made it didn't seem to work. Unless the default options file has a flaw, I'm still confused.
Taking as reference the options.rpy generated by default on Ren'py 6.6, on line 148, there is something like this:

Code: Select all

        # style.default.font = "DejaVuSans.ttf"
The line is commented-out, so you don't need to have the DejaVuSans.ttf file in each game's directory in order to use Renpy's default font. This means that if you want to use another font, you need to do three things:
1: Copy the font file into the game directory (the place where options.rpy and script.rpy are created by default).
2: Change in the options file the name of the file to the appropriate one.
3: Uncomment the line (remove the leading '#'), so Ren'py actually reads and executes it. (Did you do this?)

I've just tried to put the Comic Sans font included in Windows and it worked fine, so that's all.
Jukilum wrote:On a side note, after I finished my first game and started another, when I clicked on the edit script button nothing happens. Now I have to go open the files by hand (Oh no, manual labor!) So that must be a glitch.
Let's see... did you create the new game with the "New Project" option in the launcher? If you didn't, did you select it with the "Select Project" option? In either case, the name of the new project should be showing on the top-left corner of the launcher, in big font, and the "Edit Script" option should work properly. Maybe you created it outside the Ren'py's directory? Maybe a firewall is preventing Ren'py from invoking the editor?
I tried to reproduce the problem, but it's working fine on my machine, so I cannot help you too much on this. If you can find a way to reproduce the problem, this would help to track it and find its cause (which is the essential step before finding the solution).
Jukilum wrote:I read something about being able to put some of the code in different files. Could someone explain that a bit more clearly to me please?
Ok... you can have as many script files as you want. The only requirement is that they must have a .rpy filename extension, and that they must be inside the game directory (where the script.rpy and options.rpy are). The way Ren'py works, there is no difference between having each block of code in its own file, or having everything on a single file (if you put everything that's on the options.rpy into the script.rpy, the game will work; only that the launcher will not know where to apply changes if you decide to change your game's theme). I think the script.rpy file is mandatory, but beyond that, it could perfectly be empty as long as you have a start label in one of your files. Note that all files are "mixed" together before parsing, so you cannot have two labels with the same name, and if you use the same variable name on two separate files it will (generally) refer to the same variable.
From SciTE, you can create a new file, then save it as something.rpy in the game directory, and Ren'py will find it as part of your game from that point on. Finally, note that SciTE seems to be limited to 10 open files at a time: if you open an 11th, one of the previous ones is closed. So, if you have dozens of script files for your game, the "Edit Script" function from the launcher will become quite useless.

Hope this helps.
I have failed to meet my deadlines so many times I'm not announcing my projects anymore. Whatever I'm working on, it'll be released when it is ready :P

Jukilum
Newbie
Posts: 12
Joined: Thu Feb 07, 2008 12:40 pm
Contact:

Re: Questions on making image menus, changing font, animation

#11 Post by Jukilum »

It helps very much, thanks! I did forget to remove the comment on the font.
Let's see... did you create the new game with the "New Project" option in the launcher? If you didn't, did you select it with the "Select Project" option? In either case, the name of the new project should be showing on the top-left corner of the launcher, in big font, and the "Edit Script" option should work properly. Maybe you created it outside the Ren'py's directory? Maybe a firewall is preventing Ren'py from invoking the editor?
I tried to reproduce the problem, but it's working fine on my machine, so I cannot help you too much on this. If you can find a way to reproduce the problem, this would help to track it and find its cause (which is the essential step before finding the solution).
I did everything as you said when I created it, it displays the name, but I don't think that it is a firewall considering that I can switch back to my first game and open the script again.

herenvardo
Veteran
Posts: 359
Joined: Sat Feb 25, 2006 11:09 am
Location: Sant Cugat del Vallès (Barcelona, Spain)
Contact:

Re: Questions on making image menus, changing font, animation

#12 Post by herenvardo »

Jukilum wrote:I did everything as you said when I created it, it displays the name, but I don't think that it is a firewall considering that I can switch back to my first game and open the script again.
Have you checked that the files are actually there? They should be in <Ren'py folder>\<game's name>\game\. For a new project there should be a script.rpy and an options.rpy files there. If the files are on place, the launcher has the appropriate project selected, and the Edit Script button doesn't work, I have no idea what might be wrong there. I would think the problem is on your system rather than in Ren'py itself, because it seems to be happenning only to you, but this is still plain speculation.
BTW, I guess you're using windows... and I could bet it's XP because around 70-80% of people runs WinXP (if not, it would be good to know what system are you on) :P If you're indeed on windows, make sure the project name doesn't have any unusual characters.. it's true that the old DOS limitations with filenames are supposed to be solved since Win95, but it's also true that unusual characters (anything beyond letters, digits, underscores, hyphens, and a single dot separating filename from extension) in filenames are causing problems every now and then, in each version of windows.
Also, you might also try to create another new project: if the "Edit Script" works with it, you can safely assume that the problem is only with that project; it's quite strange for it to work on one of the projects but not on the other, so it's worth to check one more to see what's the "norm" and what's the exception.

That's all I can come by; maybe if PyTom sees this might shed some light on the issue... I've wide experience in general Windows troubleshooting, but PyTom surely knows Ren'py better than me.
I have failed to meet my deadlines so many times I'm not announcing my projects anymore. Whatever I'm working on, it'll be released when it is ready :P

Jukilum
Newbie
Posts: 12
Joined: Thu Feb 07, 2008 12:40 pm
Contact:

Re: Questions on making image menus, changing font, animation

#13 Post by Jukilum »

The files are definitely there, I've started to edit them. And actually, I'm using this on an OSX.

Post Reply

Who is online

Users browsing this forum: snotwurm