Jump to content
  • Advertisement
Sign in to follow this  
Ronel123

Problem whit integers and pointers?

This topic is 3337 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

Hi everyone. I dont know if im in the right place,but i hope i am. I'm making a space invaders like game in C.Using allegro. So i think i have a problem. i needed to draw the enemy ships.i done it.but then i wanted to make them move(animate them(i used 3 bitmaps:1st is the normal,2nd moves little left,3rd moves little right)).i did that too.and it works. the code for it is herre:
if(frame_counter < 60) 
		{
			draw_sprite(buffer, Enemy01, x,y);
		}
		else if(frame_counter >= 60 && frame_counter < 120)
		{
			draw_sprite(buffer, Enemy02, x, y);
		}
		else if(frame_counter >= 120 && frame_counter < 180)
		{
			draw_sprite(buffer, Enemy01, x, y);
		}
		else 
		{
			draw_sprite(buffer, Enemy03, x, y); 
		}




But i need more enemys.so i didnt wanted to write the codes again and again for all enemy.so i made a function,it almost looks the same:
	int Enemy_Animation(int x,int y,int frame_counter,int buffer,int Enemy01,int Enemy02,int Enemy03)
    {	
		if(frame_counter < 60) 
		{
			draw_sprite(buffer, Enemy01, x,y);/
		}
		else if(frame_counter >= 60 && frame_counter < 120)
		{
			draw_sprite(buffer, Enemy02, x, y);
		}
		else if(frame_counter >= 120 && frame_counter < 180)
		{
			draw_sprite(buffer, Enemy01, x, y);
		}
		else 
		{
			draw_sprite(buffer, Enemy03, x, y); 
		}
        }




so when i want to draw an enemy and the animation then i call the function like this:
Enemy_Animation(80,100,frame_counter,buffer,Enemy01,Enemy02,Enemy03);
and this works fine too.but when i compile it(im using Dev-C++)it gives me a warnings like this: 95 E:\C programming\Allegro\sajat\Pelda_08\main.c [Warning] passing arg 4 of `Enemy_Animation' makes integer from pointer without a cast 95 E:\C programming\Allegro\sajat\Pelda_08\main.c [Warning] passing arg 5 of `Enemy_Animation' makes integer from pointer without a cast 95 E:\C programming\Allegro\sajat\Pelda_08\main.c [Warning] passing arg 6 of `Enemy_Animation' makes integer from pointer without a cast 95 E:\C programming\Allegro\sajat\Pelda_08\main.c [Warning] passing arg 7 of `Enemy_Animation' makes integer from pointer without a cast but it still runs the game,and all of the enemys are there and moving like i made them to move. So in the end: I want to know if this pointer integer conversions will be problems for me later?or i can let them be the way they are.cuz they wont harm my program. I hope i explained what i wanted and its understandable,and i hope that somone can help me whit this. thanks in advance.Ronel

Share this post


Link to post
Share on other sites
Advertisement
From glancing at the Allegro docs, it looks like those four arguments should be of type BITMAP*. Why have you made them ints?

Share this post


Link to post
Share on other sites
hi,i dont know why i made them int,but you are right,i changed them and now everything works fine.

Thanks for helping me

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!