Join us on Discord!
You can help CodeWalrus stay online by donating here.
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - semiprocoder

#241
TMP edit: Here is the code that draws the level menu. I also uploaded what it looks like:

function drawNumsBoard(gc, sBX, sBY, sX, sY, bW, bH)--sB-sizeBoard, sX-startX, sY-startY, bW-boardWidth, bH-boardHeight
local sizeRectX=bW/sBX
local sizeRectY=bH/sBY
gc:setColorRGB(Colors[boardColor][2])
    for i=0, sBY do
        gc:drawLine(sX, sY+sizeRectY*i, sX+bW, sY+sizeRectY*i)
    end
for i=0, sBX do
gc:drawLine(sX+sizeRectX*i, sY, sX+sizeRectX*i, sY+bH)
end
gc:setColorRGB(Colors[numColor][2])
for i=1, sBY do
for j=1, sBX do
centerText(gc, tostring((i-1)*sBX+j), sX+sizeRectX*(j-1/2), sY+squareSize*(i-1/2))
end
end
gc:setColorRGB(Colors[cursorColor][2])
gc:drawRect(sX+X*sizeRectX, sY+Y*sizeRectY, sizeRectX, sizeRectY)
gc:setColorRGB(0x000000)
end


Here is the line of code that runs it: drawNumsBoard(gc, 10, 5, 0, 0, dispX-1, dispY-1)--dispX and dispY are the screen sizes


EDIT: As of now I have 300 levels! And there is an updated menu!

There is an attached source this time because I am no longer coding in the actuall student software because it keeps crashing on me, so I now code in notepad++.

As for the controls, you move the rectangle with the arrow keys and click on a circle to select it's color. Then you aim it to the other color circle. The aim is to fill the board and connect all the circles. When you win the board you can press enter to advance to the next level by pressing enter. Hope that made sense. Btw I am still new to this forum how do you add images to the middle of the post instead of only the end. I don't really need to know that much but it would be nice.

The controls are also in the readme and in the help menu.

If you want to make levels use this code in processing. To add a new flow dot, just click on the square you want and it will go through all the colors currently available. If you want to change the size of the level then just change the boardSize variable to whatever you want. To actually play your level(sort of it is not as polished as flow) you press the right arrow key(and to go back to editing you press the left arrow key). Then while playing you click on a square with a full flow thingy, which selects the color, and then you click anywhere you want to create a smaller circle on the square you clicked on, which represents the path. To reset the board, simply press R. Then, to actually submit what you created to me, just reply with the latest string that was printed to the console. Here is the code to put in processing to make the levels.

int board[][]=new int[8][8];
int playBoard[][]=new int[8][8];
int boardSize=5;//change this for different board sizes-----------------------------
int X=0;
int Y=0;
int maxNum=12;
boolean play=false;
int prevX=-1;
int prevY=-1;
import java.util.Arrays;
void settings(){
  size(800,800);
}
void setup(){
  board=new int[boardSize][boardSize];
  playBoard=new int[boardSize][boardSize];
  for(int i=0;i<boardSize;i++){
    for(int j=0;j<boardSize;j++){
      board[i][j]=0;
    }
  }
}
void fillColor(int i, int j){
  int temp;
  if(!play)
    temp=board[i][j];
  else
    temp=playBoard[i][j];
  if(temp>maxNum)
    temp-=maxNum;
  switch (temp) {
        case 1: fill(255, 0, 0);
          break;
        case 2: fill(0, 0, 255);
          break;
        case 3: fill(0, 255, 0);
          break;
        case 4: fill(255, 255, 0);
          break;
        case 5: fill(255, 128, 0);
          break;
        case 6: fill(0, 255, 255);
          break;
        case 7: fill(128, 0, 0);
          break;
        case 8: fill(0, 128, 0);
          break;
        case 9: fill(255, 30, 128);
          break;
        case 10: fill(128, 15, 128);
          break;
        case 11: fill(128, 128, 128);
          break;
        case 12: fill(255, 255, 255);
          break;
        default: fill(0, 0, 0);
          break;
      }
}

void mouseClicked(){
  if( !play){
  if(board[X][Y]<maxNum)
    board[X][Y]+=1;
  else
    board[X][Y]=0;
  for(int i=0;i<boardSize;i++){
    for(int j=0;j<boardSize;j++){
      if(board[i][j]>0)
        print(Integer.toString(board[i][j]*2-1));
      else
        print(Integer.toString(0));
      if(j<boardSize-1)
        print(",");
    }
    print(" ");
  }
  println();
  }
  else{
    if(playBoard[X][Y]==0 || playBoard[X][Y]>maxNum){
      if(X>=0 && X<boardSize && Y>=0 && Y<boardSize){
        if(playBoard[X][Y]==0 && prevX>-1 && prevY>-1)
          playBoard[X][Y]=board[prevX][prevY]+maxNum;
      }
    }
    else{
      prevX=X;
      prevY=Y;
    }
  }
}

void draw(){
  fill(0,0,0);
  rect(0,0,width,height);
  stroke(250,255,255);
  for(int i=0;i<=boardSize;i++){
    line(0, i*height/boardSize, width, i*height/boardSize);
    line(i*width/boardSize, 0, i*width/boardSize, height);
  }
  X=mouseX*boardSize/width;
  Y=mouseY*boardSize/height;
  for(int i=0;i<boardSize;i++){
    for(int j=0;j<boardSize;j++){
      noStroke();
      if(!play){
        fillColor(i,j);
        ellipse((4*i+2)*width/boardSize/4, (4*j+2)*height/boardSize/4, width/boardSize/2, height/boardSize/2);
      }
      else{
        if(playBoard[i][j]>0 && playBoard[i][j]<=maxNum){
          fillColor(i,j);
          ellipse((4*i+2)*width/boardSize/4, (4*j+2)*height/boardSize/4, width/boardSize/2, height/boardSize/2);
        }
        else{
          fillColor(i,j);
          ellipse((4*i+2)*width/boardSize/4, (4*j+2)*height/boardSize/4, width/boardSize/4, height/boardSize/4);
        }
      }
    }
  }
}
void keyPressed(){
  if(keyCode==RIGHT){
    play=true;
    for(int i=0;i<boardSize;i++){
      for(int j=0;j<boardSize;j++){
        playBoard[i][j]=board[i][j];
      }
    }
  }
  if(keyCode==LEFT){
    play=false;
  }
  if(key=='r'){
    for(int i=0;i<boardSize;i++){
      for(int j=0;j<boardSize;j++){
        board[i][j]=0;
        play=false;
      }
    }
  }
}
#242
Nah I don't have a prime so I couldn't do that. I wish I had one because it seems sooo much better than an nspire based on the descriptions, but unfortunately my teacher reccomended an nspire, so I had to get one. I meant I would make an ai, not chess for the prime, sorry :(. If there are any free emulators for the prime I may start making some things for it, but I don't know about any and I don't know any prime languages.
#243
Yeah maybe I will make it. I will probably use a tutorial I found online for making a chess algorithm on gamedev. For now though I am working on remaking the game flow on android for the nspire. Once I am done with making the mechanics of it, I will post it and start polishing up this chess game and making an ai for it.
#244
Yeah. I plan to maybe eventually make an ai based on minimax. I dont personnally know how a chess ai works specifically though, so it wont be fully optimized or as good as it could be, if I decide to make it. I am not sure right now that I will make it yet, as I plan to, as I said, make some more games and then work on a long term rts project, with some small projects in between. But even if I do I am not sure that it would run at reasonable speads, as I said, so even if I end up making one I might not post it.
#245
No litterally I cant use it I tried to play games using the old apis version, and the only thing wrong with them was the string image... Also I tried myself to use image strings, because the tutorial I was taking told me to use images with strings, but it told me that it expected a ti.resorcehandle, which is the new way of changing images. Which is why I might make two separate uploads for the two different api leves, although I am not sure how I would test if the image is correct with the string version.
#246
yeah. I don't know how I would do that as I use images to load the cannon and the end images resources, but in earlier version that wouldn't work. I like the fact that earlier versions had strings, because it leaves everything up to you, instead of leaving it to the compiler, but unfortunately that is only allowed in earlier versions. Are there any ways to set the images as resources if the apilevel was >=2.0 and set them as strings otherwise?
#247
Alright I will not double post from now on. Thank you for your advice!
#248
yeah I did change the cannonball to an arc, but I didn't make it only update part of the cannonballs at a time because the lag isnt too bad, so I don't need to do so right now. Also I don't know how to make it compatible with previous versions, but you said that they work...

By the way a while ago I registered to cemetech and now I want to login, but it doesnt let me, saying that my acount inactive and tells me to ask the forum admin, however I cant find any contact info for said forum admin. Anyone hae any advice?
#249
Yeah sure I will update the original post right now.
#250
Sorry for not adding instructions. I will add a readme later. But for now, all you do is move the mouse and click on a piece, and then click where you want to move the piece to.
#251
I searched for a chess game on ti calc, and I couldn't find it, so I decided to make my own. I so far am nowhere near finishing. All that is done drawing the board and moving the pieces, but the code doesnt check for illegal moves and it allowes anything to move anywhere, including blank spaces onto pieces, for now. Also I plan to maybe eventually make an ai, but im not sure. Anyways, here is the chess game. I will probably make a few more simple games and then go on to making an empire earth like rts game.


EDIT: I updated the chess file so that it checks whether you make a valid move. It doens't detect checkmates yet, but it doesnt let you move if you are checked. Please report any bugs you find cause there were a lot during development and I might have missed some.

Also now if you press clear(ctr+del) it clears the board.

Second Edit: sorry for uploading the screenshot instead of the actual game, I was rushing to upload it.
#252
Yeah sorry I only saved the new file on my calc and didnt notice, because that glitch only happens on the calc, so I thought that everything worked, when in reality, it only worked on my calculator. I'll update the game file.
#253
Last weekend I started making a game for the ti nspire based off of learn to fly idle on kongregate. I finished it, except that I only have 3 enemies and my pics are not too good. It will be very easy to add new enemies, I just need good pictures for them. I hope you like this simple game I made.

The rules, the game, and some images are attached.
#254
I made the graphics my own, though they look bad, but I had to make the images my own.

Also I guess I will post this to the code showcase directory.
#255
I only do it in on.paint because I only run the method when I open the upgrade tab, so it only runs once, which makes it fine. If I would run it more that once I would certainly not put it in the on.paint method. I know I should move it for good coding style, but eh.

Anyways, thank you all for helping me!
Powered by EzPortal