|
Forum Index : Microcontroller and PC projects : Sprites colliding with characters of fonts and with pixels
| Author | Message | ||||
| bar1010 Senior Member Joined: 10/08/2020 Location: United StatesPosts: 197 |
Color Maximite 2 What is a good way to handle collisions of sprites with things other than other sprites and the edges of the screen? For example a sprite colliding with a character of a font or with a box shape that has been drawn? Edited 2020-10-08 05:04 by bar1010 |
||||
| TweakerRay Senior Member Joined: 01/08/2020 Location: GermanyPosts: 138 |
charmove.zip Hi ! I have not worked with sprtes yet but I am working on a small gametest with collision of chars... maybe this helps you... in this programm you can move a coursor and if you hit a star (the bait) you will hear a short beep and the baits are reduced -1 :-) I also made some barriers as # symbols... right now if you move the coursor and it gets to one of the # symbols it wont go over that... so I guess you simply do some kind of matrx where you store if the sprite can move there... I made a array (xygrid) and that stores information if there is a barrier if there is a barrier the xygrid has the value 1 on the cordinates when you try to move there the move will be reversed. for not going over the edges I simply made some restrictions... if the xcordinate is smaller your border then the move wont go there. same with ycordinates and so on if the value for x or y is to big for the other border. (see restrictions in my programm) So maybe it helps you to do the same with sprites ? Edited 2020-10-11 22:05 by TweakerRay http://tweakerray.bandcamp.com |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |