Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
aahoang
aahoang's Profile
2
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
How to move an object diagonally using keycode
[1 Reply]
16-May-2013 05:39 PM
Forum:
Programming Questions
Right now, I am only able to move my rectangle up, down, left, and right. This is what I tried to get it to move diagonally but it doesn't work
rect(x, y, 15, 15);
if (key== CODED) {
//strokeWeight(5);
if (keyCode == DOWN) {
y+=2;
}
else if (keyCode == RIGHT) {
x+=2;
}
else if (keyCode == UP) {
y-= 2;
}
else if (keyCode == LEFT) {
x-=2;
}
else if (keyCode == UP && keyCode == RIGHT) {
x+=2;
y-=2;
}
else if (keyCode == UP && keyCode == LEFT) {
x-=2;
y-=2;
}
else if (keyCode == DOWN && keyCode == LEFT) {
x+=2;
y+=2;
}
else if (keyCode == DOWN && keyCode == RIGHT) {
x-=2;
y+=2;
}
How to move the cursor with arrow keys?
[4 Replies]
15-May-2013 09:00 PM
Forum:
General Discussion
Hi I'm making a drawing program and I want to be able to draw with the arrow keys, which is basically moving the cursor with the keys. Any help would be appreciated
«Prev
Next »
Moderate user : aahoang
Forum