So, I really like playing this game. It's called Ragdoll Invaders.

What I plan to do is start with a simplified version, and get more complicated from there.

First step: Generate the sprites for it.

Anyone have any suggestions for that?


While I wait for that, I will post how I will do the AI routines.

Their movement is simple enough-every few seconds, pick a new direction to go in. For their attacks, though... For the first one, it's easy enough. Just shoot towards where you currently are. Something like:


Code:

If P>=2 //a timer that determines when to attack
A->X //A and B is your current position, and X and Y are where it's going to shoot.
B->Y


There's the beginning of the AI code.

As for movement:

Code:

randInt(1,3)->Z
L1(1)+Z->Z
L1(2)-Z->Z


I'll have to make some more code, like have a chance that Z can be negative, so it can move in more than 1 direction, and I'll have to put in some screen bounds, so it won't go past the screen edge. Shouldn't be too hard for that.

Thoughts? Questions? Comments?

EDIT:
Code so far:

Code:
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tice.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <graphx.h>

int a; // makes the integers that will, for now, be the x and y coords for the first sprite
int b;
int screenBoundSprite1;
int screenBoundSprite2;
int screenBoundSprite3;
This is an interesting game! Will you be able to handle shooting in multiple directions? Other than that, this seems like it will be a cool game. Keep it up! Very Happy
Sounds great! Just a small suggestion; I'm assuming L1(1) and L1(2) are your enemy's X and Y coordinates, so shouldn't

Code:
randInt(1,3)->Z
L1(1)+Z->Z
L1(2)-Z->Z

be

Code:
randInt(1,3)->Z
L1(1)+Z->L1(1)
L1(2)+Z->L1(2)

And then further optimization for space (only saves a few bytes, but those bytes count):

Code:
randInt(1,3->Z
Z+L1(1->L1(1
Z+L1(2->L1(2


EDIT: Realized this is a C topic, so a little off-topic optimization rant Razz
Hey,
Just another suggestion. It's usually helpful in programming languages that let you choose variable names (rip TI-BASIC) to choose meaningful variables from the beginning.

Ex. Change var names a and b to sprite1x, sprite1y.
Coder: I know, which is why I'm doing this in C.

Battlesquid: For right now, no. Although, once I do get everything else down, I do have an idea about that, but it'll be a bit complicated. Currently, I was thinking of using the number keys for shooting, not entirely unlike what Portal Returns does for shooting the portals.

123outerme: Thanks for the optimizations; I was also thinking of just letting them bounce off the walls and a invisible platform near the bottom.

Thanks for the feedback, guys! Hopefully I can get some code up and running later this weekend. Or perhaps generate a few sprites.


EDIT: I can't run ConvPNG; my computer won't let me. Is anyone here willing to convert a few images so that I can generate my sprites?

In the meanwhile, I can write code.

To-do list:

Figure out movement

Write enemy routines for moving
Figure out shooting
Powerups
Gravity (because the character is affected by it and so is some enemy projectiles)


Movement code thus far:

Code:
while ((key = os_GetCSC()) != sk_Clear) {
        if(key == sk_Up)
            sprite1y+=10;
        if(key == sk_Down)
            sprite1y-=10;
        if(key == sk_Left)
            sprite1x-=10;
        if(key == sk_Right)
            sprite1x+=10;
    }


Though how I make the sprite follow these I have no idea.
This is really cool, and making me want to get back into learning C for the 3rd 4th 5th 6th time
Phoenix: Why not?

So, anyone have any idea on how to display a sprite? I have no idea on how to work with sprites.

Of course, I could pull a TI-basic trick and use pixels to illustrate the sprite.

What do you guys think? Should I actually make a sprite, or just use pixel art for now?

Speaking of pixel art, I was thinking of doing this:

Code:
Pixel-On(X,Y)
Pixel-On(X+1,Y-1)


Should I do that? Or would it slow down the framerate too much? because for this to properly work, I need a decently high framerate.

EDIT:

Current state of code is here.
Update:

For now, I'll do the method I mentioned above. Until I get to understand the sprite routines, at least.

I should have some code by the end of the weekend, but I'm not sure, as my weekend is packed with things.

Code for movement thus far:

Code:
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tice.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <graphx.h>
int sprite1x = 100; // makes the global integers that will, for now, be the x and y coords for the first sprite
int sprite1y = 100;
int key;
void main()
{
gfx_Begin();
    while ((key = os_GetCSC()) != sk_Clear) {
        if(key == sk_Up)
            sprite1y+=2;
        if(key == sk_Down)
            sprite1y-=2;
        if(key == sk_Left)
            sprite1x-=2;
        if(key == sk_Right)
            sprite1x+=2;
    gfx_SetColor(gfx_black);
        gfx_SetPixel(sprite1x,sprite1y); //start of display for character sprite. NOTE: It will not look anything at all like a ragdoll man.
    }

}

Battlesquid wrote:
This is an interesting game! Will you be able to handle shooting in multiple directions? Other than that, this seems like it will be a cool game. Keep it up! Very Happy


Yes, I believe so. But you won't be able to shoot in more than one direction at a time.
UPDATE:

I am still working on this, and the sprite is almost finished. It looks ridiculous though, like a pirate ship wheel.

I'll try to post screenies later.
  
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 1
» 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