Advertisement Jump to content
Sign in to follow this  
jesuslives

template error: invalid use of member (did you forg

This topic is 4323 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm getting this error when I call my template:'invalid use of member (did you forget the '&'?)' This is my call: cd=collision_detection_temp<player,npc>(player1, npc1); This is my code: template <class T, class R> bool collision_detection_temp(T *attacker, R *defender){ if(attacker->direction()=='l'){ if( (attacker->x1()<(defender->x1()+defender->body_width()))&& (attacker->x1()>defender->x1())&& (attacker->y1()>defender->y1())&& ((attacker->y1()+attacker->body_height())<(defender->y1+defender->body_height()))) { return 1; } else return 0; } else if(attacker->direction()=='r'){ if( ((attacker->x1()+attacker->body_width()) > defender->x1()))&& ((attacker->x1()+attacker->body_width()) <( defender->x1()+defender->body_width())&& (attacker->y1()>defender->y1())&& ((attacker->y1()+attacker->body_height())<(defender->y1+defender->body_height())) ) { return 1; } else return 0; } };

Share this post


Link to post
Share on other sites
Advertisement
Quote:
((attacker->y1()+attacker->body_height())<(defender->y1+defender->body_height())))


((attacker->y1()+attacker->body_height())<(defender->y1()+defender->body_height())))


in both of the outermost if branches.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!