Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 04:03 15 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

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 States
Posts: 197
Posted: 07:03pm 07 Oct 2020
Copy link to clipboard 
Print this post

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: Germany
Posts: 138
Posted: 12:00pm 11 Oct 2020
Copy link to clipboard 
Print this post

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
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025