|
You last visited: Today at 21:16
Advertisement
[Java?] Tap the righ Game!
Discussion on [Java?] Tap the righ Game! within the General Coding forum part of the Coders Den category.
12/15/2017, 21:24
|
#1
|
elite*gold: 0
Join Date: Feb 2015
Posts: 2,161
Received Thanks: 330
|
[Java?] Tap the righ Game!
Huhu,
ich würde gern fürs Handy ein Spiel machen, und zwar ein Spiel bei dem man
in einer bestimmten Zeit auf das Richtige Bild klicken muss.
Als beispiel: In 2 Sekunden auf das Rote Quadrat. Dann sieht man dort
4 Quadrate in verschiedenen Farben und wenn man auf das rote Klickt kriegt
man einen Punkt, dann im nächsten Level 1 Sekunde um auf ein blaues als
beispiel zu klicken. Hat man es geschafft wieder einen Punkt. Wenn man es
nicht packt, dann kommt man auf den End Screen in dem die Punkte stehen die
man erreicht hat.
Sollte ich das lieber in HTML programmieren und dann als .apk bauen lassen?
Oder lieber direkt in Java oder sowas?
LG
Produkti'
|
|
|
12/16/2017, 16:27
|
#2
|
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 167
|
Hi, if u are learning and u want to begin in android i suggest looking this apk, no stupid android studio, no problems with activities and layouts, very simple to use.
Disadvantages: u have to code on your phone, but u can also use some libs to work on your computer, im to lazy to google them.
Processing: 
Examples:
Here some example code to start
Code:
myBox b;
//start function defined in the processing's library
void setup(){
//set canvas to size of screen
size(displayWidth,displayHeight);
//width and height contains the value of screen size, we want the box to be in the center in this example
b = new myBox(width/2,height/2,100f,100f,color(255,0,0));
}
//main loop
void draw(){
//cleans the screen and paint background in black
background(0);
b.display();
}
//listener that handles mouse clicks, in mobile touchListener..
void mousePressed(){
//mouseX and mouseY contains pointer click location
if(b.isClicked(mouseX,mouseY)){
b.toggleColor();
}
}
class myBox{
float x,y;
float w,h;
color _color;
color _toggle;
boolean selected = false;
myBox(float x,float y,float w,float h,color _color){
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this._color = _color;
this._toggle = _color;
}
void display(){
pushMatrix();
translate(x - w/2 ,y - h/2 );
fill(_color);
rect(0,0,w,h);
popMatrix();
}
public boolean isClicked(int px,int py){
return px >= x && px <= x + w && py >= y && py <= y + h;
}
public void toggleColor(){
selected = !selected;
if(selected){
this._color = color(0,255,0);
}else{
this._color = _toggle;
}
}
}
|
|
|
12/16/2017, 19:32
|
#3
|
elite*gold: 0
Join Date: Feb 2015
Posts: 2,161
Received Thanks: 330
|
Quote:
Originally Posted by elmarcia
Hi, if u are learning and u want to begin in android i suggest looking this apk, no stupid android studio, no problems with activities and layouts, very simple to use.
Disadvantages: u have to code on your phone, but u can also use some libs to work on your computer, im to lazy to google them.
Processing: 
Examples:
Here some example code to start
Code:
myBox b;
//start function defined in the processing's library
void setup(){
//set canvas to size of screen
size(displayWidth,displayHeight);
//width and height contains the value of screen size, we want the box to be in the center in this example
b = new myBox(width/2,height/2,100f,100f,color(255,0,0));
}
//main loop
void draw(){
//cleans the screen and paint background in black
background(0);
b.display();
}
//listener that handles mouse clicks, in mobile touchListener..
void mousePressed(){
//mouseX and mouseY contains pointer click location
if(b.isClicked(mouseX,mouseY)){
b.toggleColor();
}
}
class myBox{
float x,y;
float w,h;
color _color;
color _toggle;
boolean selected = false;
myBox(float x,float y,float w,float h,color _color){
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this._color = _color;
this._toggle = _color;
}
void display(){
pushMatrix();
translate(x - w/2 ,y - h/2 );
fill(_color);
rect(0,0,w,h);
popMatrix();
}
public boolean isClicked(int px,int py){
return px >= x && px <= x + w && py >= y && py <= y + h;
}
public void toggleColor(){
selected = !selected;
if(selected){
this._color = color(0,255,0);
}else{
this._color = _toggle;
}
}
}
|
Thank you very much!
|
|
|
 |
Similar Threads
|
[JAVA Error] Could not create the java virtual machine
07/21/2013 - Technical Support - 10 Replies
Schönen Abend!
Leider hat es sich aus einem unerfindlichen Grund ergeben, dass sobald ich die Minecraft.exe starten will die Errormeldung kommt.
Die Tips auf Minecraft.net habe ich schon ohne Erfolg befolgt.
Hoffe ihr könnt mir weiterhelfen...
Mein PC:
|
java virtual machine launcher could not create the java virtual machine
08/29/2011 - Minecraft - 5 Replies
Wie der Titel schon sagt ist bei mir plötzlich folgendes Problem aufgetreten
Minecraft ging immer perfekt, dann wollte ich den millionaire minecraft mod installieren und seit dem kommt immer diese fehler meldung:
java virtual machine launcher
could not create the java virtual machine
minecraft deinstalliert aber ich kann es nicht mehr installieren da die Meldung immer kommt wenn ich auch Minecraft.exe klicke
ich habe windows xp und davor lief es immer perfekt
das mit der .bat datei...
|
[Java] Could not create the Java virtual machine
06/22/2011 - Minecraft - 1 Replies
hallo ihr minecraftler ^^
habe seit heute das problem das wenn ich minecraft starte original als auch cracked das diese fehlermeldung kommt:
Java virtual machine Launcher
Could not create the Java virtual machine
|
All times are GMT +1. The time now is 21:16.
|
|