So the pic of Jake is;

Width; 255

Height; 240

I know it takes a lot of space, but it also looks the nicest.
What does the Hiiii.png turn into?
Can someone please explain to me how I display a sprite?
Look at the many toolchain examples that deal with sprites, and read the documentation:)
I am but I still don't understand it. I learn better by seeing then reading.
Take a look at the toolchain sprite example and the graphx documentation, it's very straightforward.
I actually got to that yesterday afternoon but thanks.
ANd for you people watch this. For a start, thank you people in sax for not helping me. People in sax were just trying to make me learn it myself and in the end I really appreciate it. So thats why thank you for not helping me.

And now transparent.

And now background.

And now jake in Back.
And now here is a working program.

EDIT: I have gotten rid of the purple lines.
I am trying to switch the skyline and I got the first color.

here is my code for the the thing I need help with.

Code:
#include <tice.h>
#include <graphx.h>
#include <keypadc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ti/getcsc.h>

#include "gfx/gfx.h"
#include "gfx/hiiii.h"
#include "gfx/subwaysurf.h"

#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240




//piece of code//
void drawBackground(void) {
    gfx_SetColor(0);
    gfx_FillScreen(255);

//jump is 32
/*31,63,95,127,159,191,223,255, Thats the color jumping i want. its the last column in the chart below
    https://ce-programming.github.io/toolchain/libraries/graphx.html?highlight=scaled%20sprite#default-palette*/

    // Bright neon sky gradient//trying for last column
    for (int y = 0; y < 108; y++) {//stay 0//origanally 108 // what is y++ doing?
        int color = 31 + (y / 12);// color orriganally 128// color i think has to stay at 31// 12 has to stay
        //got this from an hour of trial and error//


        gfx_SetColor(color);
        gfx_HorizLine(0, y, SCREEN_WIDTH);

    }


}//end

This is the coloring I want in order.

To view the entire project you can click here.
The skyline is getting lighter as it goes and thats what i wanna do.
I did the background.

With this being the code.

Code:
#include <tice.h>
#include <graphx.h>
#include <keypadc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ti/getcsc.h>
#include "gfx/gfx.h"
#include "gfx/hiiii.h"
#include "gfx/subwaysurf.h"

#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240





void drawBackground(void) {
    gfx_SetColor(31);
    gfx_FillScreen(255);
gfx_FillRectangle(0,0,SCREEN_WIDTH,12);
gfx_SetColor(63);
gfx_FillRectangle(0,12,SCREEN_WIDTH,12);
gfx_SetColor(95);
gfx_FillRectangle(0,24,SCREEN_WIDTH,12);
gfx_SetColor(127);
gfx_FillRectangle(0,36,SCREEN_WIDTH,12);
gfx_SetColor(159);
gfx_FillRectangle(0,48,SCREEN_WIDTH,12);
gfx_SetColor(191);
gfx_FillRectangle(0,60,SCREEN_WIDTH,12);
gfx_SetColor(223);
gfx_FillRectangle(0,72,SCREEN_WIDTH,12);
}


What colors should I do for the bottom?
I want to add bushes to the bottom but I don't have any firmware and I have no accessibility to firmware that can scale a picture down. Can anyone please scale down any one of these bushes?

I would prefer this picture but whatever people can do would be great.

I would like to scale it down so that it would fit in the two black circles. It's fine if it doesn't because i'll tuck it behind jake.

If someone else thinks they have a better picture can I please use it? One more thing is, I have a filter and it doesnt let me open imgur links, so if you send a picture please don't use imgur.
I have tried to resize the following image.

The dimensions are:52x60 pixels. Is that good enough or not?
I got the sprite. The only problem I am facing is that it's ruining the rest of the colors. Here is a picture.

Here is a picture of the sprite.

I fixed it.


calcgeek
i need the tree to be clipped but i dont have a command for it, here is a pic of the problem.

You see how the tree goes to the right side of the screen. I don't want that to happen but I want to keep the tree in the same position. Here is the code I have for it so far.

Code:
 //botton left tree
      gfx_ScaledTransparentSprite_NoClip(tree, -10, 150, 2,2);

For you people that want to see the full code here you go.

Code:
#include <tice.h>
#include <graphx.h>
#include <keypadc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ti/getcsc.h>
#include "gfx/gfx.h"
#include "gfx/hiiii.h"
#include "gfx/subwaysurf.h"

#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240





void drawBackground(void) {
    gfx_SetColor(31);
    gfx_FillScreen(255);
gfx_FillRectangle(0,0,SCREEN_WIDTH,12);
gfx_SetColor(63);
gfx_FillRectangle(0,12,SCREEN_WIDTH,12);
gfx_SetColor(95);
gfx_FillRectangle(0,24,SCREEN_WIDTH,12);
gfx_SetColor(127);
gfx_FillRectangle(0,36,SCREEN_WIDTH,12);
gfx_SetColor(159);
gfx_FillRectangle(0,48,SCREEN_WIDTH,12);
gfx_SetColor(191);
gfx_FillRectangle(0,60,SCREEN_WIDTH,12);
gfx_SetColor(223);
gfx_FillRectangle(0,72,SCREEN_WIDTH,12);
}

void drawTitle(void) {
    gfx_SetTextScale(3, 3);
    gfx_SetColor(206);
    gfx_PrintStringXY("SUBWAY", 90, 1);
    gfx_SetColor(141);
    gfx_PrintStringXY("SURFERS", 85, 23);

    gfx_SetTextScale(2, 1);
    gfx_SetColor(226);
    gfx_PrintStringXY(">> CE <<", 117, 50);
}

void drawMenuButton(int x, int y, int width, int height, const char *text, int selected) {
    if (selected) {
        // Selected: bright neon colors
        gfx_SetColor(206);
        gfx_FillRectangle(x - 3, y - 3, width + 6, height + 6);
        gfx_SetColor(141);
        gfx_FillRectangle(x, y, width, height);
        gfx_SetColor(255);
    } else {
        // Unselected: darker colors
        gfx_SetColor(16);
        gfx_FillRectangle(x, y, width, height);
        gfx_SetColor(200);
    }

    gfx_Rectangle(x, y, width, height);

    gfx_SetTextScale(1, 1);
    gfx_PrintStringXY(text, x + 10, y + 8);
}


int main(void) {
    gfx_Begin();
    gfx_SetDrawBuffer();

    int selected = 0;
    int numOptions = 3;
    //uint8_t prevKeys = 0;//

   // while (1)// {
        drawBackground();
         gfx_SetPalette(global_palette, sizeof_global_palette, 0);
        //bottom right
      gfx_ScaledTransparentSprite_NoClip(tree, 240, 150, 2,2);
        //botton left tree
      gfx_ScaledTransparentSprite_NoClip(tree, -10, 150, 2,2);

      gfx_ScaledTransparentSprite_NoClip(hiiii, -13, 0, 5, 5);

    drawTitle();
/*gfx_SetTransparentColor(whatever index your color white is);
    gfx_TransparentSprite(sprite, x, y);*/

        const char *options[] = {"PLAY GAME", "MORE OPTIONS", "EXIT"};

        for (int i = 0; i < numOptions; i++) {
            int y = 130 + (i * 35);
            drawMenuButton(70, y, 180, 28, options[i], (i == selected));
        }

        gfx_SetTextScale(1, 1);
        gfx_SetColor(206);
        gfx_PrintStringXY("UP/DOWN | CLEAR exit", 100, 230);
 ;

        gfx_SwapDraw();



   /* Waits for a key */
    while(!os_GetCSC()){};

    /* End graphics drawing */
    gfx_End();

    return 0 ;
}

You can also download a file of the source code here.
Now I have an update with the trees.

And the background.

And now the trees are done.

And now a sun.

Add some buildings and we have finished the background!

And this was the original program.

And now for the menu buttons colors.
I have started working on the info tab of the game.
Here is a picture.

I have also optimized the code. It is more understandable now with clearer comments.
New project link.
I have finished working on the info tab and now I am working on the shop tab. I have not yet worked on the menu input, so I still don't have a workable menu but I am getting there. Can someone help me learn the key controls in C?
Here is a pic of the shop menu.
I will now start working on the options in the shop and the key commands to make the game more playable.
EDIT: What is the clear key value in C?
Am I getting this code correct so far?

Code:
  kb_Scan();
    if (kb_Data[3] & kb_1) {
    game();
    main();
}
    if (kb_Data[4] & kb_2) {
    shop();
    main();
}
    if (kb_Data[5] & kb_3) {
    info();
    main();
}

I have made the options, but I cant exit the program. I also have a problem with the info tab. Below you can see the problem.

And here is the full code.

Code:
#include <tice.h>
#include <graphx.h>
#include <keypadc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ti/getcsc.h>
#include "gfx/gfx.h"
#include "gfx/hiiii.h"
#include "gfx/subwaysurf.h"

#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define REC_SHOP 55

void drawSprite(void) {
gfx_SetPalette(global_palette, sizeof_global_palette, 0);
        //bottom right
      gfx_ScaledTransparentSprite_NoClip(tree, 241, 150, 2,2);
        //botton left tree
      gfx_ScaledTransparentSprite_NoClip(tree, -5, 150, 2,2);

      gfx_ScaledTransparentSprite_NoClip(hiiii, -9, 0, 5, 5);
}

void shopOptions(void) {

   gfx_SetColor(222);
   // top row//
   gfx_FillRectangle(35,25,REC_SHOP,REC_SHOP);
   gfx_FillRectangle(100,25,REC_SHOP,REC_SHOP);
   gfx_FillRectangle(165,25,REC_SHOP,REC_SHOP);
   gfx_FillRectangle(230,25,REC_SHOP,REC_SHOP);
   //2nd row//
   gfx_FillRectangle(35,95,REC_SHOP,REC_SHOP);
   gfx_FillRectangle(100,95,REC_SHOP,REC_SHOP);
   gfx_FillRectangle(165,95,REC_SHOP,REC_SHOP);
   gfx_FillRectangle(230,95,REC_SHOP,REC_SHOP);
   //3rd row//
   gfx_FillRectangle(35,160,REC_SHOP,REC_SHOP);
   gfx_FillRectangle(100,160,REC_SHOP,REC_SHOP);
   gfx_FillRectangle(165,160,REC_SHOP,REC_SHOP);
   gfx_FillRectangle(230,160,REC_SHOP,REC_SHOP);
}

void drawBackground(void) {
    gfx_SetColor(31);
    gfx_FillScreen(255);
    //the sky//
    gfx_FillRectangle(0,0,SCREEN_WIDTH,12);
    gfx_SetColor(63);
    gfx_FillRectangle(0,12,SCREEN_WIDTH,12);
    gfx_SetColor(95);
    gfx_FillRectangle(0,24,SCREEN_WIDTH,12);
    gfx_SetColor(127);
    gfx_FillRectangle(0,36,SCREEN_WIDTH,12);
    gfx_SetColor(159);
    gfx_FillRectangle(0,48,SCREEN_WIDTH,12);
    gfx_SetColor(191);
    gfx_FillRectangle(0,60,SCREEN_WIDTH,12);
    gfx_SetColor(223);
    gfx_FillRectangle(0,72,SCREEN_WIDTH,12);
    //now the bottom//
    gfx_SetColor(34);
    gfx_FillRectangle(0,228,SCREEN_WIDTH,12);
    gfx_SetColor(35);
    gfx_FillRectangle(0,216,SCREEN_WIDTH,12);
    gfx_SetColor(36);
    gfx_FillRectangle(0,204,SCREEN_WIDTH,12);
    gfx_SetColor(37);
    gfx_FillRectangle(0,192,SCREEN_WIDTH,12);
    gfx_SetColor(38);
    gfx_FillRectangle(0,180,SCREEN_WIDTH,12);
    gfx_SetColor(70);
    gfx_FillRectangle(0,168,SCREEN_WIDTH,12);
    gfx_SetColor(39);
    gfx_FillRectangle(0,156,SCREEN_WIDTH,12);
    //now for a sun//
    gfx_SetColor(231);
    gfx_FillCircle(300,15,14);
    //buildings//
    gfx_SetColor(64);
    gfx_FillRectangle(0,80,10,76);
    gfx_SetColor(40);
    gfx_FillRectangle(10,76,10,80);
    gfx_SetColor(128);
    gfx_FillRectangle(7,100,10,56);
    gfx_SetColor(115);
    gfx_FillRectangle(20,80,10,76);
    gfx_SetColor(171);
    gfx_FillRectangle(310,80,10,76);
    gfx_SetColor(228);
    gfx_FillRectangle(305,110,10,46);
}
/*- color: {index: 0, r: 255, g: 255, b: 255}
      - color: {index: 1, r: 255, g: 216, b: 0}*/
void drawTitle(void) {
    gfx_SetTextScale(3, 3);
    gfx_SetColor(206);
    gfx_PrintStringXY("SUBWAY", 90, 1);
    gfx_SetColor(141);
    gfx_PrintStringXY("SURFERS", 85, 23);

    gfx_SetTextScale(2, 1);
    gfx_SetColor(226);
    gfx_PrintStringXY(">> CE <<", 117, 50);
}

void info(void) {
    gfx_Begin();
    drawBackground();
    gfx_SetTextScale(1,1);
    gfx_SetColor(0);
    gfx_PrintStringXY("Welcome to Subway Surfers by CalcGeek",1,1);
    gfx_PrintStringXY("I wanted to learn the programming language",1,10);
    gfx_PrintStringXY("called C, and so I decided I will make a game",1,20);
    gfx_PrintStringXY("so I will stay motivated to continue learning C.",1,30);
    gfx_PrintStringXY("I saw that there was a lack of the game",1,40);
    gfx_PrintStringXY("Subway Surfers in the calculator community ",1,50);
    gfx_PrintStringXY("and so I decided that, that will be the game I ",1,60);
    gfx_PrintStringXY("will make. Thank you so much to the community on",1,70);
    gfx_PrintStringXY("Cemetech for letting me bother them all the",1,80);
    gfx_PrintStringXY("time.",1,90);
    gfx_PrintStringXY("press enter for the controls.",1,230);
       while(!os_GetCSC()){};
    drawBackground();
    gfx_SetTextScale(1,1);
    gfx_SetColor(0);
    gfx_PrintStringXY("The controls are simple.",1,10);
    gfx_PrintStringXY("The up arrow = jump.",1,30);
    gfx_PrintStringXY("The down arrow = crouch.",1,40);
    gfx_PrintStringXY("The right arrow = right.",1,50);
    gfx_PrintStringXY("The left arrow = left.",1,60);
    gfx_PrintStringXY("The second = Hoverboard (not implemented yet)",1,70);
    gfx_PrintStringXY("press enter for main menu.",1,230);
}

void shop(void) {
    drawBackground();
    shopOptions();
}

void game(void)   {
}

void drawMenuButton(int x, int y, int width, int height, const char *text, int selected) {
    if (selected) {
        // Selected: bright neon colors
        gfx_SetColor(47);//this color is for the outside selection//
        gfx_FillRectangle(x - 3, y - 3, width + 6, height + 6);
        gfx_SetColor(192);//this color is for the inside selection//
        gfx_FillRectangle(x, y, width, height);
        gfx_SetColor(239);//this color is for the middle selection//
    } else {
        // Unselected: darker colors
        gfx_SetColor(71);//this color is for the middle unselection//
        gfx_FillRectangle(x, y, width, height);
        gfx_SetColor(239);//unselected middle color//
    }

    gfx_Rectangle(x, y, width, height);

    gfx_SetTextScale(1, 1);
    gfx_PrintStringXY(text, x + 10, y + 8);
}

int main(void) {

    gfx_Begin();
    gfx_SetDrawBuffer();

    int selected = 0;
    int numOptions = 3;
    //uint8_t prevKeys = 0;


        drawBackground();
        drawSprite();

    drawTitle();
/*gfx_SetTransparentColor(whatever index your color white is);
    gfx_TransparentSprite(sprite, x, y);*/

        const char *options[] = {"PLAY GAME", "STORE", "INFO"};

        for (int i = 0; i < numOptions; i++) {
            int y = 130 + (i * 35);
            drawMenuButton(70, y, 180, 28, options[i], (i == selected));
        }

        gfx_SetTextScale(1, 1);
        gfx_SetColor(206);
        gfx_PrintStringXY("UP/DOWN | ZOOM exit", 100, 230);
 ;

        gfx_SwapDraw();

       /*kb_Scan();
         uint8_t currKeys = kb_Data[6];
          if ((currKeys & kb_Up) && !(prevKeys & kb_Up)) {
              selected--;
              if (selected < 0) selected = numOptions -1;
          }
         if ((currKeys & kb_Down) && !(prevKeys & kb_Down)) {
             selected++;
             if (selected >= numOptions) selected = 0;
         }
         if ((currKeys & kb_Clear) && !(prevKeys & kb_Clear)) {
             gfx_End();
             return 0 ;
         }*/



  while (1) {
  kb_Scan();

    if (kb_Data[1] & kb_2nd) {
    info();
    while(!os_GetCSC()){};
    gfx_End();
    return 0;
}
    if (kb_Data[3] & kb_1) {
    game();
    while(!os_GetCSC()){};
    main();
}
    if (kb_Data[4] & kb_2) {
    shop();
    while(!os_GetCSC()){};
    main();
}
    if (kb_Data[5] & kb_3) {
    info();
    while(!os_GetCSC()){};
    main();
}









   /* Waits for a key
    while(!os_GetCSC()){};
    gfx_End();
    info();
     while(!os_GetCSC()){};
    shop();
     while(!os_GetCSC()){};
    End graphics drawing*
    gfx_End();

    return 0 ;*/
}
}

New pic.
And for the new homescreen.
I made a meme out of my project.
Can someone make the tilemap data for this.

I also want the tiles to be spit out randomly. With certain tiles having hitboxes. 16x16 pixels per tile.
I am now completely stumpedtilemaps in my program, and progress has been halted for the foreseeable future 😥. I geuss I should release the source code so if anyone else wants to finish it they can. https://github.com/calcgeek/calcgeek-Subway-surfers-for-calculator
Even though I said I am putting the project on hold I have still been trying to learn tilemaps, and so far have not been successful.
calcgeek wrote:
Even though I said I am putting the project on hold I have still been trying to learn tilemaps, and so far have not been successful.


Two nested `for` loops should do it fine... While graphx's tilemaps are made for this purpose, 2 for loops nested is probably easier to understand than 'proper' tilemaps...
Ok, and how can I make that it spits out random tiles, and how can I make certain tiles have a hitbox?
  
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 5 of 5
» 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