[DEPRECATED TUTORIAL] Your first game engine tutorial
|
05-20-2021, 09:31 PM
(This post was last modified: 05-20-2021 09:33 PM by JoseskVolpe.)
Post: #1
|
|||
|
|||
[DEPRECATED TUTORIAL] Your first game engine tutorial
That's a deprecated tutorial, wich means i'll be not supporting it. I'm just giving it here because it may be interest to someone and i want to make the J2ME SDK Mobile article shorter
Download and extract Game base.zip instead Your first game engine tutorial (DEPRECATED, i'm keeping it on here because it can be your interest for it to stay here) (04-30-2021 11:53 PM)star cash Wrote: 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; 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; Your code will look like this: Code: package game.starcash; 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() And invoke your GameEngine Code: GameEngine engine; Your code will look like this: Code: package game.starcash; 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) { 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; 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 [size=xx-small]Signature[/size] [URL=https://www.exophase.com/user/JoseskVolpe/][IMG]https://card.exophase.com/2/0/45687.png?1612237163[/IMG][/URL] [align=justify][size=x-small][b]OwO ¿¿¿What is this??? *wags tail* Take my beret plz 7w7 ~[/b][/size][/align] |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
[DEPRECATED TUTORIAL] Your first game engine tutorial - JoseskVolpe - 05-20-2021 09:31 PM
|
User(s) browsing this thread: 2 Guest(s)