It is currently Tue Nov 13, 2018 9:01 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: collision collide
PostPosted: Sun Oct 07, 2018 3:29 pm 
Offline

Joined: Fri Sep 21, 2018 4:00 pm
Posts: 4
Bonjour

je cherche a réaliser une collision simple entre deux tiles
ainsi qu un bocage ou bornage du personnage
avec une explication la plus simple et precise
j ai deja un debut de jeu
un personnage qui se deplace un background
et des ennemi qui bougent

merci Thierry

Hello

I am looking for a simple collision between two tiles
as well as a grove or boundary of the character
with a simplest and most accurate explanation
I already have a start of the game
a character who moves a background
and moving enemies

thank you Thierry


Top
 Profile  
 
 Post subject: Re: collision collide
PostPosted: Sun Oct 14, 2018 6:18 pm 
Offline
User avatar

Joined: Wed Oct 15, 2008 11:50 am
Posts: 943
This should be in the nesdev section i think.

This is a big topic. You can get by with simple rectangle intersection but it costs cpu. Basically you figure out the tiles your character occupies, the inspect your map data to see if those tiles are blocking.


Top
 Profile  
 
 Post subject: Re: collision collide
PostPosted: Mon Oct 15, 2018 10:02 pm 
Offline

Joined: Wed Jul 11, 2018 10:31 am
Posts: 1
Pseudo code to check the intersection of two rectangles:

uchar Intersect(R1, R2){
if(R1.left > R2.right) return 0;
if(R1.right < R2.left) return 0;
if(R1.bottom < R2.top) return 0;
if(R1.top > R2.bottom) return 0;
return 1;
}

You can use it to check 2 objects collision. You need to take a different approach, if you want to check collisions with BG.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: nesrocks and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group