[TUTORIAL] Creating class in J2ME SDK Mobile
|
05-20-2021, 09:26 PM
(This post was last modified: 05-20-2021 09:42 PM by JoseskVolpe.)
Post: #1
|
|||
|
|||
[TUTORIAL] Creating class in J2ME SDK Mobile
¿What is J2ME SDK Mobile?
J2ME SDK Mobile is a tool that lets you create Java ME games and applications in your phone, without the need of a PC. You can see more informations and download it here: [APP] J2ME SDK Mobile Introduction I've had received some messages that correlates with the "¿how do i begin?" issue. It's about how do you create a new class in your project ¿What are classes? First, Java is a object-oriented programming, and it works by polimorphism It means that you can script a object a single time, and then just extend it to change some of it's attributes Polimorphism So, for example, if i wanna create a NPC J2ME native's libraries has a Sprite class. So i could extend it to make it as Sprite class So, i can create a new .java file with this code. J2ME SDK Mobile will already partially generate this code when i create a new class Code: package my.game.package; Additionally, i can now create a Ally, Player and Zombie class with their own variables, extending any feature i can create on my parent classes. So, if i modify my NPC class. Both my Ally, Zombie and Player classes will extend these modifications easier and faster to program, avoiding the need to script the same thing many times. Player: Code: package my.game.packages.npcs; Ally: Code: package my.game.packages.npcs; Zombie: Code: package my.game.packages.npcs; From this, i've created this structure:
Creating a new class tutorial
Errata I cannot edit it, so i'll levae it here I've wrote it: Code: public damage(int hpLoss){ It's wrong, because damage() is a method, and is written as a constructor We should do this instead: Code: public void damage(int hpLoss){ [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 »
|
User(s) browsing this thread: 1 Guest(s)