I'm not sure if this is off-topic, since it doesn't deal with Python
itself, but here goes:
I'm messing around with writing a simple "game" where the player (a
crudely drawn smiley face) moves by rotating and moving back or forward
(think Resident Evil, but from an always-above view). After much
hacking, I have it working where left and right rotate the player sprite
and up always moves the sprite whichever direction it's facing, while
down is reverse. I'm using pygame.transform.RotoZoom().
My problem is that it doesn't rotate smoothly. When it rotates, the
corners of the image (just a plain white background) look like they're
hitting some barrier and making it move around. Think of an empty box
turned diagonally (so that it looks like a diamond, with its open end
facing you), and a cube in that box being turned while it's resting in
the bottom corner. I want it to rotate smoothly around its center, it's
it's not doing that.
I'm guessing that it has something to do with me not setting up a Rect
right, but I'm not sure. Maybe this is a limitation of Rotozoom/Rotate?
Any advice would be greatly appreciated. And yes, I'm a rank PyGame newbie.
Thanks,
J. W. McCall 2 2036
J. W. McCall wrote: I'm not sure if this is off-topic, since it doesn't deal with Python itself, but here goes:
I'm messing around with writing a simple "game" where the player (a crudely drawn smiley face) moves by rotating and moving back or forward (think Resident Evil, but from an always-above view). After much hacking, I have it working where left and right rotate the player sprite and up always moves the sprite whichever direction it's facing, while down is reverse. I'm using pygame.transform.RotoZoom().
My problem is that it doesn't rotate smoothly. When it rotates, the corners of the image (just a plain white background) look like they're hitting some barrier and making it move around. Think of an empty box turned diagonally (so that it looks like a diamond, with its open end facing you), and a cube in that box being turned while it's resting in the bottom corner. I want it to rotate smoothly around its center, it's it's not doing that.
I'm guessing that it has something to do with me not setting up a Rect right, but I'm not sure. Maybe this is a limitation of Rotozoom/Rotate?
Any advice would be greatly appreciated. And yes, I'm a rank PyGame newbie.
I'm not sure - haven't actually used rotozoom, but from the docs it
returns a surface containing the rotated images. The problem with that
is that a rotated surface wont fit in to the same area, so what you get
back will be bigger than the original. If you want to draw it at the
same position, move the rotated surface so that the centre point is the
same as the original unrotated image.
Creating a new sprite each time is probably quite inefficient. You might
want to look at OpenGL, which is excellent for 2D and 3D games.
HTH,
Will McGugan
-- http://www.willmcgugan.com
"".join( [ {'*':'@','^':'.'}.get(c,None) or chr(97+(ord(c)-84)%26) for c
in "jvyy*jvyyzpthtna^pbz" ] )
On 2005-05-20, J. W. McCall <jm*****@houston.rr.com> wrote: I'm not sure if this is off-topic, since it doesn't deal with Python itself, but here goes:
I'm messing around with writing a simple "game" where the player (a crudely drawn smiley face) moves by rotating and moving back or forward (think Resident Evil, but from an always-above view). After much hacking, I have it working where left and right rotate the player sprite and up always moves the sprite whichever direction it's facing, while down is reverse. I'm using pygame.transform.RotoZoom().
My problem is that it doesn't rotate smoothly. When it rotates, the corners of the image (just a plain white background) look like they're hitting some barrier and making it move around. Think of an empty box turned diagonally (so that it looks like a diamond, with its open end facing you), and a cube in that box being turned while it's resting in the bottom corner. I want it to rotate smoothly around its center, it's it's not doing that.
I'm guessing that it has something to do with me not setting up a Rect right, but I'm not sure. Maybe this is a limitation of Rotozoom/Rotate?
Any advice would be greatly appreciated. And yes, I'm a rank PyGame newbie.
You might want to try pygsear: http://www.nongnu.org/pygsear/
It has a RotatedImage class which takes care of rotating
things for you. See the examples roti.py and wings.py
for some use of rotated image sprites. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Andr? Roberge |
last post by:
Sorry about the cryptic subject line, but I wanted to capture the
essence of my message in a single line.
I am learning Python (which, as everyone know is the best language :-)
so that I can...
|
by: Marian Aldenhövel |
last post by:
Hi,
I am trying to make pygame play music on windows. This simple program:
import pygame,time
pygame.init()
print "Mixer settings", pygame.mixer.get_init()
print "Mixer channels",...
|
by: Tim Knauf |
last post by:
Hi everyone, I'm glad to have found this list.
I've written a small script for my own use which, amongst other things,
captures mouse click information from a window containing an image. I
used...
|
by: Brent W. Hughes |
last post by:
I'm just starting to learn pygame. I write what I think is just about the
simplest program that should display a window and then quit.
#-----------------------------------------------
import sys...
|
by: kjm |
last post by:
Hi everyone,
I have recently acquired a Logitech Rumble pad to use as an input
device. I have been having trouble getting the event que to respond
that a button or hat arrow has been pressed. ...
|
by: liuliuliu |
last post by:
hi -- sorry if this is trivial -- but how do you make a screenshot of a
pygame display? i have a surface which is basically the entire visible
screen -- how do you write this surface as an image...
|
by: dynamo |
last post by:
Hi guys i have come again with more problems.This time it has to do with pygame.The following code does not give any error messages but it does not do what it is supposed to do either.the code is a...
|
by: globalrev |
last post by:
im doing this :
http://www.learningpython.com/2006/03/12/creating-a-game-in-python-using-pygame-part-one/
and when closing the program the window stays up and doesnt respond. i
tried adding...
|
by: globalrev |
last post by:
http://www.pygame.org/docs/ref/mixer.html
import pygame
#pygame.mixer.init(frequency=22050, size=-16, channels=2,
buffer=3072) //it complained abiout words=
so i guess its only the nbrs...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
|
by: ezappsrUS |
last post by:
Hi,
I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
|
by: jack2019x |
last post by:
hello, Is there code or static lib for hook swapchain present?
I wanna hook dxgi swapchain present for dx11 and dx9.
|
by: DizelArs |
last post by:
Hi all)
Faced with a problem, element.click() event doesn't work in Safari browser.
Tried various tricks like emulating touch event through a function:
let clickEvent = new Event('click', {...
| |