I am working on a mini game and would like to match my sprite placement to predetermined screen coordinates that I have figured out from a background image. unfortunately the coordinates on the image don't match those on the image . there appear to be MARGINS that such that renpy seems to insist that 0,0 is actually quite a ways from the screen it's not going from the center either so I can't navigate from that. anybody got any clue how I can get renpy to rever to a traditional x,y coordinate system
[edited for further description]
I'm using the sprite manager to place the sprites
pin point precision and sprite placement
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.
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.
-
- Newbie
- Posts: 9
- Joined: Fri Jan 02, 2015 6:41 am
- Contact:
pin point precision and sprite placement
Last edited by Eatrentpie on Fri Jan 10, 2020 4:36 am, edited 1 time in total.
- VimislikArt
- Regular
- Posts: 90
- Joined: Sun Mar 06, 2016 6:50 pm
- Projects: King of the Cul-De-Sac
- Deviantart: vimislikart
- itch: vimislikart
- Location: Rochester, NY
- Contact:
Re: pin point precision and sprite placement
When you're setting your transform properties, add the statement "subpixel True". This changes how Ren'py interprets the value behind xpos and ypos. You may have to adjust the xanchor and yanchor values depending on how you were calculating the positioning (I think ren'py defaults to the top left of images, so this applies to the xpos and ypos as well).
For instance, this would move the image 500 pixels to the right, and 300 pixels down, but based on the bottom left of the image.
For instance, this would move the image 500 pixels to the right, and 300 pixels down, but based on the bottom left of the image.
Code: Select all
show exampleimage:
subpixel True xpos 500 ypos 300 yanchor 1.0
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: pin point precision and sprite placement
I almost exclusively place my sprites using xpos and ypos, and I don't recognize this problem.Eatrentpie wrote: ↑Thu Jan 02, 2020 10:15 pm I am working on a mini game and would like to match my sprite placement to predetermined screen coordinates that I have figured out from a background image. unfortunately the coordinates on the image don't match those on the image . there appear to be MARGINS that such that renpy seems to insist that 0,0 is actually quite a ways from the screen it's not going from the center either so I can't navigate from that. anybody got any clue how I can get renpy to rever to a traditional x,y coordinate system
I often use a screen like this to check positions in the screen in-game.
Code: Select all
default mx=0
default my=0
screen showPos():
text str(mx) + ":" + str(my)
timer 0.05 action [SetVariable("mx",renpy.get_mouse_pos()[0]), SetVariable("my", renpy.get_mouse_pos()[1])] repeat True
label start:
show screen showPos
One possible explanation of the "margin effect" could be that the image contains more "empty space" around your character than you take into the consideration. Possibly the image top left corner is at the screen 0,0 but there is space in between the character and the screen sides because there are "empty space" in the image.
-
- Newbie
- Posts: 9
- Joined: Fri Jan 02, 2015 6:41 am
- Contact:
Re: pin point precision and sprite placement
I'm using the spritemanager so not sure if the above suggestions will work.
it's the same thing that runs the stars in the starfield demo.
actually I know that wont work.
it's the same thing that runs the stars in the starfield demo.
actually I know that wont work.
Re: pin point precision and sprite placement
Check the code to verify the SpriteManager got no borders.
The SpriteManager can define an area of rendering, and coordinates of Sprites are relative to that, not the entire screen.
Posting the code here should help.
The SpriteManager can define an area of rendering, and coordinates of Sprites are relative to that, not the entire screen.
Posting the code here should help.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.
10 ? "RENPY"
20 GOTO 10
RUN
10 ? "RENPY"
20 GOTO 10
RUN
-
- Newbie
- Posts: 9
- Joined: Fri Jan 02, 2015 6:41 am
- Contact:
Re: pin point precision and sprite placement
no borders are ever defined at initialization and the manager uses the entire 1920 by 1080 screen it just places things funny
Who is online
Users browsing this forum: No registered users