We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello! I'm trying to make a piece where a small icon is moved by using the arrow keys. I've been trying for a while to find out how to do it, but I can't find help as to what code is needed and how to do it! I can make my images move but not with the arrow keys. I'd greatly appreciate any help!
This is what I'm working with so far:
import ddf.minim.spi.*;
import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.ugens.*;
import ddf.minim.effects.*;
//17000 hz mosquito frq
AudioPlayer player;
Minim minim;
//Minim mysound;
float y;
float x;
PImage photo;
PImage photo1;
int xpos= 200;
int ypos= 200;
void setup() {
size(768,567);
y = height;
photo = loadImage("ash.png");
photo1 = loadImage("lavender_town_remake__night_time__by_creepypasta81691-d4wxz46.png");
//minim = new Minim(this);
//player = minim.loadFile("Awesome Video Game Music #12!- Pokemon- RedBlue - Lavender Town Theme");
// player.play();
}
void draw() {
background(0);
image(photo1, 0, 0);
image(photo, 0, y);
image(photo,xpos,y);
xpos=xpos+1;
//if (ypos>height+20)
//{
//xpos=-20;
if(y > 0) {
y = y - 2;
}
}
//void stop()
//{
// player.close();
//minim.stop();
//super.stop();
//}
Answers
http://studio.processingtogether.com/sp/pad/export/ro.9bY07S95k2C2a/latest
got it to work thank you!
Or something like this with the myCar function:
http://www.openprocessing.org/sketch/103475
I remember that sketch from an old post: =:)
http://forum.processing.org/one/topic/how-do-i-make-an-object-disappear-upon-collision
And seems like I did my own tweaks for it as well. Check it out! :D
"CarGame.pde":
"Sprite.pde":