12 Apr 2022 |
| @ic_xc_nika:matrix.org joined the room. | 18:38:59 |
| @ic_xc_nika:matrix.org left the room. | 18:39:33 |
18 Apr 2022 |
| @wybpip:matrix.org joined the room. | 12:40:35 |
| @wybpip:matrix.org left the room. | 12:40:36 |
27 Apr 2022 |
| @tuxedoedpenguin:matrix.org joined the room. | 06:14:19 |
2 May 2022 |
| @wybpip:matrix.org joined the room. | 00:27:07 |
| @wybpip:matrix.org left the room. | 00:27:08 |
5 May 2022 |
| @anulo2:matrix.olimpololaschi.com joined the room. | 09:57:30 |
10 May 2022 |
| @anulo2:matrix.olimpololaschi.com left the room. | 08:18:09 |
11 May 2022 |
| @tuxedoedpenguin:matrix.org left the room. | 06:27:03 |
14 May 2022 |
| @vxtreniusx:matrix.org changed their display name from vXtreniusX to magmaus3. | 13:55:42 |
18 Jun 2022 |
| @183231bcb:matrix.org joined the room. | 14:35:04 |
@183231bcb:matrix.org | Hi | 14:35:48 |
| @183231bcb:matrix.org changed their display name from 183231bcb to 183231bcb (She/They). | 15:54:56 |
@vxtreniusx:matrix.org | In reply to @183231bcb:matrix.org Hi Hello! | 17:28:44 |
24 Jun 2022 |
| @183231bcb:matrix.org left the room. | 20:48:38 |
25 Jun 2022 |
| @better_sleeping:converser.eu joined the room. | 13:48:56 |
| @better_sleeping:converser.eu left the room. | 13:49:23 |
4 Jul 2022 |
freshreplicant | If you're making a platformer with Pygame, what would you guys general use for the player's position? | 19:43:11 |
freshreplicant | like self.rect.? = self.position | 19:45:30 |
ultidonki | I'm not totally sure what the question is, sorry (And I don't think I've ever used pygame enough to make a platformer or be confident with it!).
But if I understand correctly: I think I would make position 2 seperate variables:
self.pos_x and self.pos_y
Then update with:
self.rect.x = self.pos_x
self.rect.y = self.pos_y
If you're wondering what variables you can use with self.rect, always check the docs/API: https://www.pygame.org/docs/ref/rect.html
So, by reading this page, I can see that I can use self.rect.x, self.rect.y, but also self.rect.topleft which accepts a tuple,
self.rect.topleft = (self.pos_x, self.pos_y)
so you can do stuff like that but personally I would keep it dead simply by only using rect.x and rect.y
Also from that page I can see you can use rect.move(little_x, little_y), which moves the rect just a little amount in the x or y direction. The alternative would be:
self.rect.x = self.rect.x + little_x
self.rect.y = self.rect.y + little_y
But, hopefully I was answering the right question?! | 21:43:49 |
ultidonki |
- Oops, actually you need to use self.rect.move_ip(little_x, little_y) because self.rect.move doesn't actually move the rect - just returns a new rect. So if you wanted to use move, you need to use
self.rect = self.rect.move(little_x, little_y) or self.rect.move_ip(little_x, little_y)
- Obviously none of this code is tested, and might do differently from what I'm expecting, but hopefully it's right 😉
| 21:46:39 |
freshreplicant | I was following a tutorial where they had the player's position set to something like self.rect.bottomleft = self.position, but it didn't really make sense to me. | 22:21:49 |
freshreplicant | I switched it to self.rect.middlebottom, because I'm assuming that the middle and bottom of the player's rect. | 22:22:31 |
freshreplicant | In this case self.position is a vector, so self.position = vector(x, y) or something. | 22:23:42 |
5 Jul 2022 |
ultidonki | Yeah, it's good if a tutorial explains why they do something, rather than just doing something weird. I think rect's internally use left, top, width, height, to remember their position and size. Topleft seems traditional in some other game engines I've used (like Godot), there's probably a reason for it but I don't know! You can use any offset, like rect.middlebottom sounds fine. I use topleft because so many other game engines use it, it's easier for me to remember rather than use something different 😀 | 12:36:06 |
10 Aug 2022 |
| freshreplicantchanged room power levels. | 18:02:28 |
18 Aug 2022 |
| @vxtreniusx:matrix.org left the room. | 14:45:03 |
23 Sep 2022 |
| @kenyy28:matrix.org left the room. | 20:58:05 |
23 Jul 2023 |
| @seabass:fosdem.org left the room. | 22:03:20 |