![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | potatobanana |
not pivot_offset. but just like normal sprite offset. because i want it spawn postion use that offset
node2d
-button
-popuppanel
![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | potatobanana |
not pivot_offset. but just like normal sprite offset. because i want it spawn postion use that offset
node2d
-button
-popuppanel
![]() |
Reply From: | njamster |
There is no offset
-property for PopupPanel. However, you can position it freely by using the rect_position
-property. If you really need a separate offset-value (why?), you could store it in an script attached to the PopupPanel.
because want it popup in middle of my cell.
right now
what i want to
potatobanana | 2020-03-20 15:06
Add this script to your PopupPanel:
extends PopupPanel
func place_at(center_point):
rect_position = center_point - rect_size/2
popup()
Then all you need to do is get the coordinates of your cell (by calling map_to_world
) and pass them as an argument to place_at
.
njamster | 2020-03-21 11:42
if tile_cell_at_mouse_pos == 1:
$shop_popup.rect_global_position = (map_to_world(tile_pos)+ cell_size/2 )- $shop_popup.rect_size /2
$shop_popup.popup()
thanks
potatobanana | 2020-03-21 12:01