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.
-
doudoulolita
- Newbie
- Posts: 12
- Joined: Tue Jan 17, 2012 3:45 pm
-
Contact:
#1
Post
by doudoulolita » Tue Jan 17, 2012 4:02 pm

I want to make this small penguin (found in
Jnavigue game) move on the roads of the island I've created :
I made this
script but it doesn't work. The user's input on keyboard does'nt work. I tried also with direction keys but it was the same problem. My displacement function is OK, I think.
I don't know how to use
ui.key or
ui.keymap or the
key fonction, I tried all of them without success.
-
Eliont
- Regular
- Posts: 110
- Joined: Thu Aug 06, 2009 6:51 am
- Completed: Begin of Evangelion, SAO - Smile of the black cat, SAO - Project "Ceramic Heart", Time for Dragons
- Location: Russia
-
Contact:
#2
Post
by Eliont » Wed Jan 18, 2012 12:26 pm
Use
http://www.renpy.org/wiki/renpy/doc/coo ... onami_Code to control game with keyboard.
Actiual recipe:
Code: Select all
class KeyboardListener(renpy.Displayable):
def __init__(self):
renpy.Displayable.__init__(self)
# This function listens for events.
def event(self, ev, x, y, st):
# We only care about keydown events.
if ev.type != pygame.KEYDOWN:
return
if ev.key == pygame.K_SPACE:
renpy.notify("K_SPACE PRESSED")
ui.pausebehavior(0.001)
return
# Return a small empty render, so we get events.
def render(self, width, height, st, at):
return renpy.Render(1, 1)
# Create a Listener to actually listen for the code.
keyboard_listener = KeyboardListener()
screen Keyboard_Listener:
add(keyboard_listener)
label start:
show screen Keyboard_Listener
..........
-
doudoulolita
- Newbie
- Posts: 12
- Joined: Tue Jan 17, 2012 3:45 pm
-
Contact:
#3
Post
by doudoulolita » Thu Jan 19, 2012 1:27 pm
Thank you.
Is it possible without a class or with simpler code ?
Every example I find is rather complicated and I'm a beginner. I thought Renpy was very simple at first sight but for more interaction, it's not so simple.
Users browsing this forum: Google [Bot]