Moving sprites with keyboard inputs
Forum rules
Questions about Ren'Py should go in the Ren'Py Questions and Announcements forum.
Questions about Ren'Py should go in the Ren'Py Questions and Announcements forum.
-
- Newbie
- Posts: 4
- Joined: Sun Aug 09, 2020 10:08 am
- Completed: None (yet)
- Projects: Bond of Heroes
- Location: Belgium
- Contact:
Moving sprites with keyboard inputs
I'm creating an RPG visual novel, and I want the main character to move when I press a certain key on my keyboard. I've been looking all over the internet and nothing that I found really helped me. The problem isn't the moving of the character, but the problem is that I don't know how to make the game check for a button press. Could somebody help me?
Re: Moving sprites with keyboard inputs
I did side-scroller in renpy, used custom displayable, in render method i polled keyboard and gamepad state and updated pc and camera positions.
Keyboard was polled by pygame.key.get_pressed() call - https://www.pygame.org/docs/ref/key.htm ... et_pressed
If you don't want to dive deep and don't need real-time movement i suggest simple adding keys to screen or even left/right imagebuttons.
Keyboard was polled by pygame.key.get_pressed() call - https://www.pygame.org/docs/ref/key.htm ... et_pressed
If you don't want to dive deep and don't need real-time movement i suggest simple adding keys to screen or even left/right imagebuttons.
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350
-
- Newbie
- Posts: 4
- Joined: Sun Aug 09, 2020 10:08 am
- Completed: None (yet)
- Projects: Bond of Heroes
- Location: Belgium
- Contact:
Re: Moving sprites with keyboard inputs
Thank you! You helped me a lot.
Just one more question: How do I import Pygame? (I’m completely new at python so I don’t know)
Just one more question: How do I import Pygame? (I’m completely new at python so I don’t know)
Re: Moving sprites with keyboard inputs
Code: Select all
init python:
import pygame
I may be available for hire, check my thread: viewtopic.php?f=66&t=51350
-
- Newbie
- Posts: 4
- Joined: Sun Aug 09, 2020 10:08 am
- Completed: None (yet)
- Projects: Bond of Heroes
- Location: Belgium
- Contact:
Re: Moving sprites with keyboard inputs
Thank you so much! It works now!
Who is online
Users browsing this forum: No registered users