dedomil.net - Mobile Games Forum
GAMELOFT VS JAVA GAMES - Printable Version

+- dedomil.net - Mobile Games Forum (http://dedomil.net/forum)
+-- Forum: Off Topic Section (/forumdisplay.php?fid=3)
+--- Forum: Off Topic discussion (/forumdisplay.php?fid=4)
+--- Thread: GAMELOFT VS JAVA GAMES (/showthread.php?tid=441)

Pages: 1 2 3 4 5 6 7


RE: GAMELOFT VS JAVA GAMES - JoseskVolpe - 04-30-2021 10:17 PM

(04-30-2021 07:23 PM)star cash Wrote:  You mean i can use my java phone to create java game??????

You can with this app. But i don't recommend it by experience. It takes so long and is hard to compile, have a big issue setuping libraries, is full of errors, and you would take hours or days doing stuff you could do in minutes from a PC. I don't advise its use for long projects, only for very small projects.
That's a good idea for a developers event tho: Create a simple J2ME game using only J2ME tools like PaintCAD, Opera Mini and J2ME SDK Mobile


J2ME, as a old technology, has a advantage of being possible to develop for in old and cheap PCs. Basically with a Windows XP, with a old Pentium Duo, on a CRT screen, on a old Eclipse version, and Java 1.3, you can create games and apps for it much easier and faster than on a Java phone.


RE: GAMELOFT VS JAVA GAMES - JoseskVolpe - 04-30-2021 11:47 PM

(04-30-2021 11:44 PM)star cash Wrote:  Drop link for the app use for creating java game with java phone

http://ultraplicativos.blogspot.com/2013/10/download-j2me-sdk-mobile_30.html

Better mirror: [attachment=3369]


RE: GAMELOFT VS JAVA GAMES - JoseskVolpe - 05-01-2021 12:57 AM

(04-30-2021 11:53 PM)star cash Wrote:  
(04-30-2021 11:47 PM)JoseskVolpe Wrote:  
(04-30-2021 11:44 PM)star cash Wrote:  Drop link for the app use for creating java game with java phone

http://ultraplicativos.blogspot.com/2013/10/download-j2me-sdk-mobile_30.html

Where should i click to start creating game

First, don't forgot to set file write/read permissions to "Allowed" or "Ask one time"

Go to "New Project...", specify your Project's name and its Folder Location, and click create. This will create a new project. > Click "Create" Soft Button and Create.
Now you should create your first package. Go to Source Packages > Left/Right Soft Key (it depends on your phone) > New > Java Package > Create > Specify your package name with dots and everything lower case (for example: "game.starcash") > right/left soft and "Finish"

Open your new package > left/right shoft > New > Java MIDlet > Name it anything > then create

A code will apear:

Code:
package game.starcash;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class Game extends MIDlet{

public void startApp(){
//When player opens or resume your game
}

public void pauseApp(){
//When player minimizes your game, or receives a call, or system pauses it
}

protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
//When player closes your game
}

}

Now you need to create a displayable and invoke it, you can create a new Java file for it, but you can make it inside the same file in the same class

Add the following line:

Code:
import javax.microedition.lcdui.game.GameCanvas;
class GameEngine extends GameCanvas{
protected GameEngine(boolean suppressKeyEvents) {
super(suppressKeyEvents);
//when invoked by the Game class
}

public void paint(Graphics g){
//Use this to render your game
//You can also use this to update each frame, although it will use the same thread
repaint();
}

public void Update(){
//Use this to update each frawme
}
}

Your code will look like this:

Code:
package game.starcash;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class Game extends MIDlet{

public void startApp(){
//When player opens or resume your game
}

public void pauseApp(){
//When player minimizes your game, or receives a call, or system pauses it
}

protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
//When player closes your game
}

class GameEngine extends GameCanvas{
protected GameEngine(boolean suppressKeyEvents) {
super(suppressKeyEvents);
//when invoked by the Game class
}

public void paint(Graphics g){
//Use this to render your game
//You can also use this to update each frame, although it will use the same thread
repaint();
}

public void Update(){
//Use this to update each frame
}
}

}

Now you invoke wit into your startApp() class and begin it
Don't forget startApp() is also used when you're resuming it, so you need to store in a variable your app was already started
Code:
boolean gameStarted=false; //False for the first startApp()
public void startApp(){
if(!gameStarted){
//First start()
}
gameStarted=true;
}

And invoke your GameEngine

Code:
GameEngine engine;

public void startApp(){
//When player opens or resume your game
    if(!gameStarted){
        //First start()
        engine = new GameEngine(false);
        }
        gameStarted=true;
        
        
        Display.getDisplay(this).setCurrent(engine);
}

Your code will look like this:

Code:
package game.starcash;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.GameCanvas;

public class Game extends MIDlet{

boolean gameStarted=false; //False for the first startApp()
GameEngine engine;
    
public void startApp(){
//When player opens or resume your game
    if(!gameStarted){
        //First start()
        engine = new GameEngine(false);
        }
        gameStarted=true;
        
        
        Display.getDisplay(this).setCurrent(engine);
}

public void pauseApp(){
//When player minimizes your game, or receives a call, or system pauses it
}

protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
//When player closes your game
}

class GameEngine extends GameCanvas{
protected GameEngine(boolean suppressKeyEvents) {
    super(suppressKeyEvents);
//when invoked by the Game class
}

public void paint(Graphics g){
//Use this to render your game
//You can also use this to update each frame, although it will use the same thread
repaint();
}

public void Update(){
//Use this to update each frawme
}
}

}

You are almost there, now you need to create a new thread, or in a easier way for this example, create a loop for the Update() method into the GameEngine, running separated from the paint() Thread:

Code:
while(true) {
            engine.Update();
        }

You can also use Thread.sleep() for limiting the FPS, but Java phones are very slow in performance so you won't need it at all, only for emulators, wich has FPS Limit in their settings

Now this is your first Game Engine code:W

Code:
package game.starcash;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.GameCanvas;

public class Game extends MIDlet{

boolean gameStarted=false; //False for the first startApp()
GameEngine engine;
    
public void startApp(){
//When player opens or resume your game
    if(!gameStarted){
        //First start()
        engine = new GameEngine(false);
        }
        gameStarted=true;
        
        
        Display.getDisplay(this).setCurrent(engine);
        
        while(true) {
            engine.Update();
        }
}

public void pauseApp(){
//When player minimizes your game, or receives a call, or system pauses it
}

protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
//When player closes your game
}

class GameEngine extends GameCanvas{
protected GameEngine(boolean suppressKeyEvents) {
    super(suppressKeyEvents);
//when invoked by the Game class
}

public void paint(Graphics g){
//Use this to render your game
//You can also use this to update each frame, although it will use the same thread
repaint();
}

public void Update(){
//Use this to update each frawme
}
}

}

Follow the comment instructions, and good work :3

You will see there'll be nothing dispaying on your game, or it'll be stuck in the loading time. It's because there's nothing for it to paint on the screen. Play with the g variable (Graphics class) on the paint() method and have fun


RE: GAMELOFT VS JAVA GAMES - Abidemhie - 05-01-2021 01:01 AM

Someone upload somewhere else

The sdk


RE: GAMELOFT VS JAVA GAMES - Abidemhie - 05-01-2021 01:07 AM

The app that he gave link for...
Someone should upload directly or give another link


RE: GAMELOFT VS JAVA GAMES - Abidemhie - 05-01-2021 01:13 AM

I cant download...
Language barriers and stuffs


RE: GAMELOFT VS JAVA GAMES - JoseskVolpe - 05-01-2021 01:14 AM

(05-01-2021 01:01 AM)Abidemhie Wrote:  Someone upload somewhere else

The sdk

http://dedomil.net/forum/showthread.php?tid=5579


RE: GAMELOFT VS JAVA GAMES - Abidemhie - 05-01-2021 01:49 AM

Thanks bro.