So, I have decided to make a prequel and a sequel to Cat Nipper. (My contest entry)
I felt like the storyline required more games to go with it. The first game (It is almost done) is about the attacking pirates and you trying to defeat them. The third game may be about dodging asteroids or something, but that remains to be seen.

CaterPi/Caterite is done!
I don't know if I will be making the next installment anytime soon, I have to become able to get by with xlibC before I attempt the side scrolling asteroid dodging game. Very Happy Download link on the next page of this topic.

Caterite is being ported to the monochromes under the name MonoCaterite!
Hopefully I won't get tooooo sidetracked. Razz

Screenshots:

Cat Nipper:



Caterite Attack



MonoCaterite:
coming soon!
First question!
Can have an If statement inside of an If statement? If not, is there a way to achieve something like this?


Code:

If A=24
Then
10->C
If G-46
Then
Code....
End
End
Do you mean something like an 'and'? You could do something like this:
(If I am reading that right. Razz )

Code:
If A=24 and G-46
Then
...
End


But yes, you could probably make an if-if loop using Ans or something like that... Hope this helps! Smile
Hmm....
That might work, never thought of that!
In fact, it definitely should work!

Talk about a brain fart Razz
Unicorn wrote:
Talk about a brain fart Razz

Oh well! Very Happy It happens. Smile Good luck on this project; looking spiffy! Smile
Update! There is now two enemies and more to come as you progress through the levels.

Screenshot:

Caterite Attack is pretty much done now, all I need to do is incorperate some new colors that DJ_O suggested.
Unicorn wrote:
Caterite Attack is pretty much done now, all I need to do is incorporate some new colors that DJ_O suggested.

Neat! Any new color scheme ideas? How many levels do you have? Nice work! Smile
So far 3 levels, but they are pretty easy to make, just increasing the health of the enemies. I am going to make the background black with a pink ship and green bullets and red enemy ships.
Check out what they should look like here:
Unicorn: Rather than advertising Code Walrus, it would save people clicks if you just embed the screenshots in your post using [img] tags. Out of curiosity, do you plan to give users the option to switch between several color schemes, or do you plan to to have a single refined color scheme?
Sorry. I would have put the screenshots here, but I am on my kindle so I can't copy the image URLs. I'll update that post when I get computer access.

I think I will keep the colors preset, though this might happen: When the user finishes the game they could unlock the new color.
I am also going to make it so that the player has to have beaten the first part to continue to the second part.
Well Caterite Attack is done and I am jusr adding some code optimizations. But, my main problem is that I am having some trouble making an astroid dodging game, and I decided to try to make it in xLIBC. If anyone knows some good sprite/collision tutorials please tell me about them.
Unicorn wrote:
Well Caterite Attack is done and I am jusr adding some code optimizations. But, my main problem is that I am having some trouble making an astroid dodging game, and I decided to try to make it in xLIBC. If anyone knows some good sprite/collision tutorials please tell me about them.
Do you have any specific questions on sprites and collisions that we could answer? I know that Chickendude is working on an assembly tutorial that will include information about sprites and collisions, and while those general skills apply to any language, as a non-ASM coder you might find the material dense. In general, for sprites you need a collection of image data (for xLIBC, that's what we call a spritesheet, stored in an AppVar), and commands for where and how to display those sprites. xLIBC offers a number of commands for displaying sprites, which you can find among the commands listed on the DCS WIki. Collision is a little trickier: there are two major ways you can do collision detection. The first is a graphical method: you test pixels to see if any object is in the location to which you're try to move an object like an enemy, the player, a bullet, etc. If the pixels are a known color, you can deduce that they are part of a particular object. However, this can be tricky if you have a colorful screen, a background, and so on. The other way is to use the fact that you probably know the location of all of the objects on the screen, and to check the position of the thing you're moving against the locations of all the other objects on the screen.

I hope this helps.
So, optimization for Caterite Attack.
I have this code, and I know it is extremly bad for my calc, but it is the only thing I could come up with. If you have any optimizations, please post them.


Code:

8->A
8->B
Lbl 1
While 1
getkey->M
Output(A,B,"W        #Player
Output(G,H,"V        #Enemy
#Movement code goes here
If M=21
Then
A->C
B->D
While 1
C+1->C
Output(C,D,".
If C=G and D=H
Then
Q+1->Q     #Q is enemy Health
goto 1
End
End
End
End
Using Goto to escape from a loop will cause you to leak memory and eventually crash.
elfprince13 wrote:
Using Goto to escape from a loop will cause you to leak memory and eventually crash.


Exactly what I was told, that is why I am asking if anyone has any good optimizations.
Well, you might consider using appropriate loop conditions instead of an infinite loop Wink
Here is what I came up with:

Code:
8->A:Ans->B
While 1
 Repeat M=21
  getkey->M
  Output(A,B,"W
  Output(G,H,"V
 
  #Movement code goes here
 
 End
 A:Repeat Ans=G
  Ans+1
  Output(Ans,B,".
 End
 Q+(B=H->Q
End


Don't forget, with optimizations, showing more code is always a good thing. Wink Not only will this reduce the size, but also speed up your program as well, because now it doesn't need to scan past that loop. Wink

EDIT: Also, based on the code you provided, I think that Ans+1 in the nested Repeat Loop should actually be an Ans-1.... But that's just what I infer...

Also Part of this EDIT: Also, I'm going on a wild guess here and assuming that you may also want to exit from within the inner loop, say for example the [CLEAR] key. Here's one method; could be done many other ways as well for speed optimization and size; but I leave that to you. Wink Nice work! Smile

Code:
8->A:Ans->B
Repeat M=45
 Repeat Ans or M=45
  getkey->M
  Output(A,B,"W
  Output(G,H,"V
 
  #Movement code goes here

  M=21
 End
 If Ans
 Then
  A:Repeat Ans=G
   Ans+1
   Output(Ans,B,".
  End
  Q+(B=H->Q
 End
End
When I run your first code, I get an Error : Domain. What causes this? I don't use Ans anywhere else in the program, or maybe B is wrong. I'll do some more testing.
Unicorn wrote:
When I run your first code, I get an Error : Domain. What causes this? I don't use Ans anywhere else in the program, or maybe B is wrong. I'll do some more testing.

Have you defined all of your variables? The output statements aren't going to work correctly if they aren't. In addition, I believe that the Ans+1 should be Ans-1. I wasn't sure, because that was what was in the original. Wink
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
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 vote in polls in this forum

 

Advertisement