Made an android game with Processing!

Hey guys! I'm really excited because I've just finished creating an android game with Processing and it just went up on the Google Play Store. It's a bit barebones right now but I'm still so excited!

Here's the link to the game in case anyone's interested:

It's a side-scroller where you play as a bus jumping over trees while collecting coins. It made perfect sense to me when I was building it :P

It'd mean a lot to me if you guys could check it out. Any comments or suggestions are more than welcome!

I'm going to add a Pause button, different types of obstacles and maybe play around with weather and backgrounds as well soon.

Let me know what you guys think :)

submitted by /u/anonymymity
[link] [comments]

Keyboard inputs (WASD) not working on

Hey all, I just finished an iteration of a project I'm working on for a uni class. It's working great in the Processing IDE and I'm pretty proud of my progress, so I wanted to show it to some friends on openprocessing. I got the images to upload with @pjs preload, now the only issue I have is that it won't recognize any keyboard input at all. At the bottom of the main sketch, I have keyPressed() and keyReleased() methods changing booleans to control my character with WASD, but none of them are registering a keypress as the boolean doesn't change from false ever. (I added a println to print the status of my up boolean, it is always false even if w is pressed) This is especially perplexing as I just looked at another sketch that did nearly the exact same thing, and it works fine. I've been at this for hours, please help.

My game:

Sketch where keyboard commands work:

submitted by /u/SeanRaider87
[link] [comments]

Help With saveFrame();

My code needs to import a movie, add some animations, and then save the movie (using saveFrame()). The issue is that the number of frames saved isn't anywhere near the number I need to make a smooth movie later on. The original is 5 seconds long, 30 fps, but only something like 18 frames are saved. I've tried frameRate() and delay() in draw() but it doesn't seem to work. Is there a fix to this? Here's the simplified code:

import*; Movie myMovie; void setup() { size(1920, 1080); background(0); myMovie = new Movie(this, "Video.mp4"); myMovie.loop(); } void draw() { image(myMovie, 0, 0); if(myMovie.time()>3 && myMovie.time()<5) ellipse(200,200,50,50); saveFrame("frames/####.png"); } void movieEvent(Movie m) {; } 

Edit: For clarity, I tried frameRate() and delay() in draw() thinking that it would reduce the number of frames rendered per second; perhaps my system takes time to save 1920x1080 frames. Still don't know exactly the issue though, as these didn't seem to work very well.

submitted by /u/satchitchatterji
[link] [comments]

Help with processing.js

Hi all! I've only just started learning Processing so bear with me if my question is really straightforward.

I created a game in Processing and it runs perfectly when run on my own computer. The problem comes when I try to embed it into a webpage. As I understand it, processing.js is meant to convert .pde files to understandable javascript that browsers are able to understand. processing.js works perfectly when I only have a void() and draw() function, but it stops working I define other functions.

My question is do I have to rewrite my entire processing code without functions? That is, include everything into draw?

Or is there something else I'm just completely missing?

submitted by /u/anonymymity
[link] [comments]

How to do automatic hitboxes based on alpha pixels?

So, essentially I am making a game which has interactable items. Each of these items do something on hover. I just need to figure out the best way to find the hitboxes for these items, without doing it by hand (ie figure out a rectangle around the item).

Here is a solution I thought of but I'm not sure how to make it happen.

What I have:

a full-screen PNG for each item, which are layered on top of one another in this order:

  • Background
  • Item 1
  • Item 2 etc

My solution:

  • Use some sort of get command for each png image to find any pixels with alpha value >0 (anything with an alpha of 0 would not be part of the hitbox)

I'm thinking the relevant code is going to look something like this.

whatever = loadImage(whatever.png) if (whatever.get(alphaValueAt(mouseX, mouseY)) > 0) { whatever.hitboxDetect(True); } 

I'm just not sure what to type online to get the alpha value of a specific pixel.

If someone could guide me towards how to do this or the processing documentation for a similar function, I'd be greatful.

I could also use help if someone else has done this before, because I have some other concerns such as:

  • Each time the mouse is moved, it runs a hitbox function for each layer of the image. Depending on how much processing power returning a value at pixel takes, this could maybe make the program lag if the mouse is moved too fast?

Anyways, ty for your help!

submitted by /u/NexEternus
[link] [comments]