Hello , i'm here again, let me start whit saying how great i think this community is, as it is not the first time i posted my questions here and a alway got good and usefull answeres from friendly people i thank you all for it and will help once my turn comes people from this community for shure.
Now here comes my question , even tought it may already be asked once , in that case pleas likn to the topic,
i would like to make an image clickable, but not like an ellipse or square around the immage, only the image itself, but i have no idea how to do this, i'll post a picture whit this question to illustrate my problem, i allready thank you people a lot for the help you give.
Hello and Happy new year to all of those who read my post,
I'm here once again whit a problem in my Code,
I'v been working on this game in whitch for now i have a red dot you can move whit awsd keys and a green dot witch trys to catch up whit the red dot, and also a life bar for the red dot witch lowers down when the greed dot touches the red dot.
I would like it if when the player clicks whit the mouse on a location of the screen, a ellipse witch represents a bullet will come from the red dot and go to the pointed location, if it touches the borders of the screen i want it to do nothing and when it touches the green dot i can give it some effects.
The problem is i have no idea how to make an ellipse that stays after the mouse press and how to make it possible to get multiple bullets over the screen at one time...
coul you have a tought about how i could make this work, i would be vey gratefull.
i won't put my code on here right now but if needed i will.
The only thing is that the code has to be pretty basic because i'm doing this as a school project and i don't want to just copy and paste, the main goal is to discover new ways of coding but also to be able to understand them and be able to reuse them.
Hello, i am trying to make this litle games , in witch the player has to move around, for now the player is a red ellipse and the enemie the green one , my problem here is that my wqsd movement is a bit glitchy.
could any one , direct me to a topic where this issue has been solved or help me to get rid of the lag, i would be verry greatfull.
(sorry for the spelling mistakes i'm french.)
PImage inter;
int x= 100;
int y= 100;
float vie= 150;
float x1= 900;
float y1 = 250;
void setup() {
size(1000, 500);
frameRate(300);
smooth();
inter = loadImage("inter.png");
}
void draw() {
background (255, 255, 255);
inter ();
BH();
mvmnt();
vie();
ennemi();
}
void BH() {
fill(255, 0, 0);
ellipse(x, y, 25, 50);
smooth();
}
void mvmnt() {
if (keyPressed) {
if (y>55) {
if (key== 'z'||key== 'Z') {
y=y-1;
}
}
else {
y=y;
}
if (y<445) {
if (key== 's'||key== 'S') {
y=y+1;
}
}
else {
y=y;
}
if (x>44.5) {
if (key== 'Q' || key == 'q') {
x=x-1;
}
}
else {
x=x;
}
if (x<957.5) {
if (key == 'd'|| key == 'D') {
x=x+1;
}
}
else {
x=x;
}
}
}
void inter() {
image(inter, 0, 0);
}
void vie() {
rect(800, 5, vie, 20);
if (x==x1 && y==y1) {
if (vie>0) {
vie = vie-0.2;
}
}
}
void ennemi() {
fill (0, 192, 0);
ellipse (x1, y1, 20, 20);
if (x1>x) {
x1=x1-0.25;
}
if (x1<x) {
x1=x1+0.25;
}
if (y1<y) {
y1=y1+0.25;
}
if (y1>y) {
y1=y1-0.25;
}
}
and here the image you need to make the whole code working: