Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Graphic and array problem

Author
Message
speede
14
Years of Service
User Offline
Joined: 22nd Oct 2010
Location: UK
Posted: 20th Dec 2010 15:08
Hi there.

I am in the middle of doing my 1st college project. They have asked me to produce a Space Invaders game and for that I would like to use arrays. The problem is I can't get my pictures to work with arrays, I have been trying to figure out what the problem is from the last couple of days! I tried to pass the arrays to other functions, but now even if I try to do something in Main it still doesn't work.

I have got a quick example over here, as I don't want to paste in the whole code (too much reading ). Could anyone please try to help me or at least explain what am I doing wrong?

Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 20th Dec 2010 19:15
You haven't drawn them to the screen using the dbSync() command.

Here's a rewritten main loop for you:



speede
14
Years of Service
User Offline
Joined: 22nd Oct 2010
Location: UK
Posted: 20th Dec 2010 20:28
Thank you for the quick reply!

I tried what you said, but it still shows only one picture on the screen. Do you think that there might be something wrong with my computer or am I doing something wrong? I am asking, cause I have got NVidia GeForce card and I know it doesn't show some of DarkGDK commands like dbCircle, dbEllipse, dbDot and maybe this is the case?

Here is the rewritten code:
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 20th Dec 2010 22:26
How big is the image? If it's greater than 10 by 10 then the drawn images will overlap perhaps making it look like only one image.


speede
14
Years of Service
User Offline
Joined: 22nd Oct 2010
Location: UK
Posted: 20th Dec 2010 23:41
The image is 7x7 so I guess that this is not the case. I thought that you can use arrays to store same type of data doesn't matter the size? I am getting confused, my teacher asked me to use arrays to display 5 columns of aliens 5 in each row. How can I accomplish that?
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 21st Dec 2010 03:07
I forgot...you need to make individual sprites in order to see separate images. For every bullet, you need a new spriteID.

Example



speede
14
Years of Service
User Offline
Joined: 22nd Oct 2010
Location: UK
Posted: 21st Dec 2010 13:05
I really hoped it is going to be something simple as this!

Thank you so much for your help, it works fine for me now
Dar13
16
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 21st Dec 2010 16:13
Your welcome, it was my pleasure.


Login to post a reply

Server time is: 2024-11-19 14:43:29
Your offset time is: 2024-11-19 14:43:29