You are not logged in.
Lost Password?


Register To Post



 Bottom   Previous Topic   Next Topic

#1
CAPITAN SEVILLA II GAME
Posted on: 2010/10/18 11:51
Virtual Freak
Joined 2008/5/30
Spain
78 Posts
CoderLong Time User (11 Years) PVBCC 2010 2nd
hello, I'm programming a new game based on characters from old Spanish game called "Captain Sevilla '", I know nothing of programming in C and I need your help.(what little I know is thanks to your comments and demos)

when include in the code new documents. h , the screen appears black. Why?

I leave the code works. I want to include the character and move it for the background (for the moment,jejeje)

thank you very much for your time!!

my english is very bad, sorry!!

Attach file:



jpg  Sin título-2.jpg (51.34 KB)
794_4cbc19fbd93f3.jpg 382X223 px

jpg  mariano.jpg (109.05 KB)
794_4cbc1a09a8061.jpg 533X311 px
rar vep.rar Size: 12.93 KB; Hits: 182
vb capitan.VB Size: 64.00 KB; Hits: 194
c capitan.c Size: 1.21 KB; Hits: 206
Edited by rubengar on 2010/10/18 12:14
Edited by rubengar on 2010/10/18 12:20
Edited by rubengar on 2010/10/18 12:21
Top

#2
Re: CAPITAN SEVILLA II GAME
Posted on: 2010/10/18 19:41
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (13 Years) PVBCC 2010 3rd
Rubengar, I took a look at the code you posted (capitan.c) and I tried to make it easier to read and give you some tips in the comments. Other than some minor readability issues, it looks pretty good. If you want an example of moving a character around on the screen, check out demo 2 in that folder of 6 demos I posted. Also, I would recommend switching from the single file libgccvb to the more complete version that's spread over multiple files (that's also in the folder with my demos.)

Tambien, no te sientas mal de su ingles... Deseo que hable espanol como te hablar ingles!

Attach file:


c capitan.c Size: 1.47 KB; Hits: 231
Edited by Fwirt on 2010/10/18 19:51
Edited by Fwirt on 2010/10/18 19:52
Top

#3
Re: CAPITAN SEVILLA II GAME
Posted on: 2010/10/18 21:23
PVB Elite
Joined 2008/12/28
Slovenia
633 Posts
Highscore Top ScoreHighscore Top ScoreCoderContributor10+ Game RatingsLong Time User (10 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
Quote:

Fwirt wrote:
Also, I would recommend switching from the single file libgccvb to the more complete version that's spread over multiple files (that's also in the folder with my demos.)


Maybe his libgccvb.h #includes them, so he doesn't need to bother with it. That's what mine does.

Also, why do you use for(;;) instead of while(1)? Is there any advantage, or is it just a stylistic choice? I believe that the compiler will recognize 1 as being always true and will not generate code to test the condition.
Top

#4
Re: CAPITAN SEVILLA II GAME
Posted on: 2010/10/18 22:10
Virtual Freak
Joined 2008/5/30
Spain
78 Posts
CoderLong Time User (11 Years) PVBCC 2010 2nd
Tanks for your time!!


what is the error?? the screen goes black when I include more documents. h!!!

Attach file:


c capitan.c Size: 1.63 KB; Hits: 204
Top

#5
Re: CAPITAN SEVILLA II GAME
Posted on: 2010/10/19 1:01
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (13 Years) PVBCC 2010 3rd
Quote:

HorvatM wrote:
Maybe his libgccvb.h #includes them, so he doesn't need to bother with it. That's what mine does.

That's what mine does too, actually. I guess I wasn't thinking... . I assumed that he had the single file one because when I started programming that version was all that I could find.

Quote:

HorvatM wrote:
Also, why do you use for(;;) instead of while(1)? Is there any advantage, or is it just a stylistic choice? I believe that the compiler will recognize 1 as being always true and will not generate code to test the condition.

RunnerPack suggested that to me. I always used to use while(1) because I thought that was correct (and I still think it's more readable) but RunnerPack suggested that for(;;) was a tiny bit faster. Now that you bring it up and I did some research, I'm not sure if that's actually true (maybe someone knowledgeable can tell me either way?)

Quote:

rubengar wrote:
what is the error?? the screen goes black when I include more documents. h!!!

I'm sorry rubengar, I don't understand... Do you mean that when you include a file called "documents.h" your screen won't display anything, or do you mean that if you try to include any more files in your program, your screen blacks out? Either way, unless you're changing something in your main function, it shouldn't be affecting your display... (Unless you're running out of memory somehow?)

EDIT: I just made a quick C program:

int main
() {
    while(
1);
    
//for(;;);
    
return 0;
}
...to test the while vs. for thing and compiled it twice (once with the for commented out, once with the while commented out) with gcc -S to generate an assembly listing. It came out the same both times. So they are functionally equivalent then. There's really only going to be one infinite loop in your program anyway, but I guess you can choose which way you want to do it without speed concerns...
Edited by Fwirt on 2010/10/19 1:13
Top

#6
Re: CAPITAN SEVILLA II GAME
Posted on: 2010/10/19 2:07
Nintendoid!
Joined 2009/8/11
USA
112 Posts
Long Time User (10 Years)
Quote:

HorvatM wrote:
why do you use for(;;) instead of while(1)? Is there any advantage, or is it just a stylistic choice? I believe that the compiler will recognize 1 as being always true and will not generate code to test the condition.


You are right, no speed advantage with modern compilers. Plus, even if it was a dumb compiler and did use a few extra clocks, who cares?

But the real reason is because it is bad programming practice to check an expression that can only equate one way (for example, while(1) can only be true in this case). So if you check your code using something like a lint checker or misra rule checker, this would be flagged as an error.
Top

#7
Re: CAPITAN SEVILLA II GAME
Posted on: 2010/10/19 3:57
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (13 Years) PVBCC 2010 3rd
Quote:

mbuchman wrote:
You are right, no speed advantage with modern compilers. Plus, even if it was a dumb compiler and did use a few extra clocks, who cares?

A few extra clock cycles can make a big difference in timing critical situations! What if it was the difference between finishing your polygon drawing routine and having to wait another frame? Of course if it was that critical you would probably be writing assembly, but still...
Top

#8
Re: CAPITAN SEVILLA II GAME
Posted on: 2010/10/19 9:50
Virtual Freak
Joined 2008/5/30
Spain
78 Posts
CoderLong Time User (11 Years) PVBCC 2010 2nd
Quote:

Fwirt wrote:

I'm sorry rubengar, I don't understand... Do you mean that when you include a file called "documents.h" your screen won't display anything, or do you mean that if you try to include any more files in your program, your screen blacks out? Either way, unless you're changing something in your main function, it shouldn't be affecting your display... (Unless you're running out of memory somehow?)



if I try to include any more files in my program, my screen blacks out.

Thanks for your time!!
Top

#9
Re: CAPITAN SEVILLA II GAME
Posted on: 2010/10/19 11:29
VUE(xpert)
Joined 2003/9/3
Sweden
442 Posts
PVBCC EntryHighscore Top10 3rdCoderContributorHOTY09 2ndLong Time User (15 Years) DonatorApp CoderPVBCC 2010 1st20+ Game RatingsPVBCC 2013 2nd
It's hard to say without knowing exactly what files you are trying to include. Maybe they are too large and contain too much data? The VB only has 64 KB of ram you know...
Top

#10
Re: CAPITAN SEVILLA II GAME
Posted on: 2010/10/19 12:20
Virtual Freak
Joined 2008/5/30
Spain
78 Posts
CoderLong Time User (11 Years) PVBCC 2010 2nd
I solved the problem !! I change the part in the BAT file that refers to padding the ROM!! thanks friends!!!!
Top

 Top   Previous Topic   Next Topic


Register To Post