Moving objects on the screen (updated info)

Moving objects on the screen (updated info)

Post by fadi razoo » Sat, 21 Jun 2003 23:57:41



Hi

I am currently working on a space game. I am using Borland Turbo C 1987/1988/1989 Compiler. This will be similar to ASTEROIDS and I will need to know how do I make a circle or a polygon lets say move on the screen smoothly as if it is realy floating in space. Also it can be useful if you can help me about making a simple triangular ship move in space (a small hint will do). I have come up with a couple of good ideas, but may be you can tell me better simpler ideas.

The main thing I need help on is how to make that rock float in space (thats about it, if I know this, the rest will be derived from this solution).

I would like to thank everyone in advance.

fadi razook

 
 
 

Moving objects on the screen (updated info)

Post by Maynard Philbroo » Sun, 22 Jun 2003 01:49:01


you will need some more updated tools for better graphic coding..

> Hi

> I am currently working on a space game. I am using Borland Turbo C 1987/1988/1989 Compiler. This will be similar to ASTEROIDS and I will need to know how do I make a circle or a polygon lets say move on the screen smoothly as if it is realy floating in space. Also it can be useful if you can help me about making a simple triangular ship move in space (a small hint will do). I have come up with a couple of good ideas, but may be you can tell me better simpler ideas.

> The main thing I need help on is how to make that rock float in space (thats about it, if I know this, the rest will be derived from this solution).

> I would like to thank everyone in advance.

> fadi razook


 
 
 

Moving objects on the screen (updated info)

Post by Hans Galem » Sun, 22 Jun 2003 22:18:33



> I am using Borland Turbo C 1987/1988/1989 Compiler.

Please wrap your lines.

For Turbo C there is a special newsgroup:

borland.public.cpp.turbocpp

Hans.

 
 
 

Moving objects on the screen (updated info)

Post by andre » Mon, 23 Jun 2003 13:40:06


do
{
        keys=getch();
        if(keys == 'q')
        {
        fcloseall();
          closegraph();
                  exit(1);
        }
        count =0;
        w=0;
        bx=0;
        by=0;
        fin=0;

        if(keys == 'p')
        {
         printf("changeing pic");
         sel = sel + 1;
         printf("%d,",sel);
         if(sel == 0)
         {
                game = 0;
        count =0;
        sea = 7;
        b=0;
        b1=1;
        b2=2;
        b3=3;
        b4=4;
        b5=5;
        f=0;
        f1=1;
        f2=2;
        f3=3;
        f4=4;
        py=0;
        px=0;
        f5=5;
        do
        {
        map1[f] = mapch[b];
        map1[f1] = mapch[b1];
        map1[f2] = mapch[b2];  // point less, but o well//
        map1[f3] = mapch[b3];
        map1[f4] = mapch[b4];
        map1[f5] = mapch[b5];
        b = b + 6;
        b1 = b1 + 6;
        b2 = b2 + 6;
        b3 = b3 + 6;
        b4 = b4 + 6;
        b5 = b5 + 6;
        f = f + 6;
        f1 = f1 + 6;
        f2 = f2 + 6;
        f3 = f3 + 6;
        f4 = f4 + 6;
        f5 = f5 + 6;
        count++;
        }
        while(count != 300);

         }
         if(sel == 1)
         {

                game = 0;
        count =0;
        sea = 7;
        b=0;
        b1=1;
        b2=2;
        b3=3;
        b4=4;
        b5=5;
        f=0;
        f1=1;
        f2=2;
        f3=3;
        f4=4;
        py=0;
        px=0;
        f5=5;
        do
        {
        map1[f] = mapch1[b];
        map1[f1] = mapch1[b1];
        map1[f2] = mapch1[b2];  // point less, but o well//
        map1[f3] = mapch1[b3];
        map1[f4] = mapch1[b4];
        map1[f5] = mapch1[b5];
        b = b + 6;
        b1 = b1 + 6;
        b2 = b2 + 6;
        b3 = b3 + 6;
        b4 = b4 + 6;
        b5 = b5 + 6;
        f = f + 6;
        f1 = f1 + 6;
        f2 = f2 + 6;
        f3 = f3 + 6;
        f4 = f4 + 6;
        f5 = f5 + 6;
        count++;
        }
        while(count != 300);

         }                   // put the convert here save goto staments//
         if(sel == 2)     // when a key is pressed and it draws the picture, it uses the map1//
         {                                      // so if  you feed what you want you can change the key pic//

                game = 0;
        count =0;
        sea = 7;
        b=0;
        b1=1;
        b2=2;
        b3=3;
        b4=4;
        b5=5;
        f=0;
        f1=1;
        f2=2;
        f3=3;
        f4=4;
        py=0;
        px=0;
        f5=5;
        do
        {
        map1[f] = mapch2[b];
        map1[f1] = mapch2[b1];
        map1[f2] = mapch2[b2];  // point less, but o well//
        map1[f3] = mapch2[b3];
        map1[f4] = mapch2[b4];
        map1[f5] = mapch2[b5];
        b = b + 6;
        b1 = b1 + 6;
        b2 = b2 + 6;
        b3 = b3 + 6;
        b4 = b4 + 6;
        b5 = b5 + 6;
        f = f + 6;
        f1 = f1 + 6;
        f2 = f2 + 6;
        f3 = f3 + 6;
        f4 = f4 + 6;
        f5 = f5 + 6;
        count++;
        }
        while(count != 300);

         sel =-1;
         }
        }

        if(keys == 'w' || keys == 'ww')
        {
        by = by + 20;        
        objy = objy - 20;
        py = py - 1;
        cont = MPL(px,py);
        if(cont == 1)
        {
         slash(px,py,pal);
        }
        count =0;
        a=0;
        a1=1;
        a2=2;
        a3=3;
        a4=4;
        a5=5;
        do
        {
         x = map1[a] + objx;
         y = map1[a1] + objy;
         color = map1[a2];
         x1 = map1[a3] + objx;
         y1 = map1[a4] + objy;
         color1 = map1[a5];
        putpixel(x,y,pal.colors[color]);
        putpixel(x1,y1,pal.colors[color1]);
        a = a + 6;
        a1 = a1 + 6;
        a2 = a2 + 6;
        a3 = a3 + 6;
        a4 = a4 + 6;
        a5 = a5 + 6;
        count++;
        }
        while(count != 300);
        stop:
        cont =0;
        goto start;
        }

        if(keys == 's' || keys == 'ss')
        {
         by = by - 20;
        objy = objy + 20;
        py = py +1;
   cont = MPL(px,py);
        if(cont == 1)
        {
         slash(px,py,pal);
        }
        count =0;
        a=0;
        a1=1;
        a2=2;
        a3=3;
        a4=4;
        a5=5;
        do
        {
         x = map1[a] + objx;
         y = map1[a1] + objy;
         color = map1[a2];
         x1 = map1[a3] + objx;
         y1 = map1[a4] + objy;
         color1 = map1[a5];
        putpixel(x,y,pal.colors[color]);
        putpixel(x1,y1,pal.colors[color1]);
        a = a + 6;
        a1 = a1 + 6;
        a2 = a2 + 6;
        a3 = a3 + 6;
        a4 = a4 + 6;
        a5 = a5 + 6;
        count++;
        }
        while(count != 300);
        cont =0;
        goto start;
        }

        if(keys == 'd' || keys == 'dd')
        {
        bx = bx -20;
        objx = objx + 20;
        px = px + 1;
        cont = MPL(px,py);
        cont = MPL(px,py);
        if(cont == 1)
        {
         slash(px,py,pal);
        }
        count =0;
        a=0;
        a1=1;
        a2=2;
        a3=3;
        a4=4;
        a5=5;
        do
        {
         x = map1[a] + objx;
         y = map1[a1] + objy;
         color = map1[a2];
         x1 = map1[a3] + objx;
         y1 = map1[a4] + objy;
         color1 = map1[a5];
        putpixel(x,y,pal.colors[color]);
        putpixel(x1,y1,pal.colors[color1]);
        a = a + 6;
        a1 = a1 + 6;
        a2 = a2 + 6;
        a3 = a3 + 6;
        a4 = a4 + 6;
        a5 = a5 + 6;
        count++;
        }
        while(count != 300);
        cont =0;
        goto start;
        }

        if(keys == 'a' || keys == 'aa')
        {
         bx = bx + 20;
        objx = objx - 20;
        px = px - 1;
        cont = MPL(px,py);
        if(cont == 1)
        {
         slash(px,py,pal);
        }
   count =0;
        a=0;
        a1=1;
        a2=2;
        a3=3;
        a4=4;
        a5=5;
        do
        {
         x = map1[a] + objx;
         y = map1[a1] + objy;
         color = map1[a2];
         x1 = map1[a3] + objx;
         y1 = map1[a4] + objy;
         color1 = map1[a5];
        putpixel(x,y,pal.colors[color]);
        putpixel(x1,y1,pal.colors[color1]);
        a = a + 6;
        a1 = a1 + 6;
        a2 = a2 + 6;
        a3 = a3 + 6;
        a4 = a4 + 6;
        a5 = a5 + 6;
        count++;
        }
        while(count != 300);
        cont =0;
        goto start;
        }

}

while(game != 1);
end:

hope it helps,
things are missing like mapcharray[] you can feed it from a file or stat it in the file, eg, {20,23,4,12,323,2}
20 = x on screen
23 = y
4 is the color, you can use setcolor(range 16) or setrgbpalette(256)

if you use this put some of the varilabe as "register" to stop botle necks, and don't refesh the whole screen if you want a refesh rate below half a second.

 
 
 

1. Moving objects on the screen

Hi

I am currently working on a space game. This will be similar to ASTEROIDS and I will need to know how do I make a circle or a polygon lets say move on the screen smoothly as if it is realy floating in space. Also it can be useful if you can help me about making a simple triangular ship move in space (a small hint will do). I have come up with a couple of good ideas, but may be you can tell me better simpler ideas.

The main thing I need help on is how to make that rock float in space (thats about it, if I know this, the rest will be derived from this solution).

I would like to thank everyone in advance.

fadi razook

2. Tutorials

3. Any Suggestions for Moving an Object across the Screen

4. LightWave Training at NewTek Day in L.A.!

5. Moving camera with moving objects in Inventor

6. Millenium/Heidi/MAX

7. for moving just one object of entiral objects...

8. Object/object intersection page updated

9. Object FAQ - Call for Updates - Readers, All Object Vendors

10. How to calculate screen coordinates and whether an object is on the screen

11. NewTek Moving Update for 2-22-2001