Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Would have loved to see this as a full game. It has a lot of potential , and the procedural generation feels really well done. (And just a quick question, how did you get smooth controls with processing? I've been struggling with that for a while now)

Thank you!

What do you mean by smooth controls? Like just the physics or the key inputs?

The key inputs. For some reason, they don't update properly for me. If I pess UP then RIGHT then release UP, then it still registers as UP for a second or so.

(1 edit)

Oh yeah that was so annoying. The way I fixed it was instead of checking if a key was pressed using keyPressed and checking hat key was being held at the time, I had up, left, down, and right variables. In the keyPressed() function I check what key is pressed and change the variable to true, and in the keyReleased() function I check which key gets released and change the variable to false. This way you can check if multiple keys are pressed at a time, and it doesn't do that weird thing where it can't decide what key is being pressed. Sorry if that was confusing but I hope it helped :)

Heres an example with two buttons (left and right)

boolean left;
boolean right;
int x;
void keyPressed(){
  if(keyCode==LEFT||key=='a'){
    left=true;
  }
  if(keyCode==RIGHT||key=='d'){
    right=true;
  }
}
void keyReleased(){
  if(keyCode==LEFT||key=='a'){
    left=false;
  }
  if(keyCode==RIGHT||key=='d'){
    right=false;
  }
}
void move(){
  if(left){
    x--;
  }
  if(right){
    x++;
  }
}
(+1)

Wow, why didn't I think of this?  It's a shame I didn't find any online tutorials or documentation dealing with this problem. Thanks a lot!