pacman, rainbows, and roller s
logo

Chatbox|Admin nhận làm wap/web, giá cả thương lượng... Thông tin admin tại mỗi bài viết.
Home · Bang hội ·
* Đăng Nhập hoặc Đăng Kí
để sử dụng hết chức năng của diễn đàn.
Hi, Khách!
HomeBang hội » Thủ thuật » Nokia s40 » Share code source j2me tổng hợp
Xuống dưới » Share code source j2me tổng hợp
avatar by Pham_loi Pham_loi
Chức vụ:
05:43:20, 06-07-2016

[Projects Game Fiery Sky - BầuTrời Rực Lửa
Cũng éo biết giới thiệu gì :D và cũng k có pic nào luôn :3
Game thuộc thể loại pém máy bay cổ điển nhưng mình đã thêm các item như hp, đạn, xu vào game và game còn có thể nâng cấp máy bay như tốc độ, tấn công , hp... Mỗi level lại có 1 boss và nó sẽ mạnh lên theo mỗi level.
* Đồ họa: 90% là mình vẽ tay nhem
* Màn hình: đã test 240x320 ngon còn đâu k biết :
* Tự bắn phím 0
* Số lượng level là: infinite , ai đến lv max thì nt mh nha @@

Update v1.1 fix trắng màn hình khi continue :3
* Jar v1.0: Fiery_Sky.jar
* Source v1.0: Src_Fiery_Sky.zip

* Jar v1.1: Tải xuống FierySky.jar (76.12 KB)
* Source v1.1: Tải xuống Src-FierySky.zip (173.03 KB)

Like: 0
avatar by Pham_loi Pham_loi
Chức vụ:
05:01:22, 22-06-2016

[Project hiệu ứng mưa rơi
Không có năng khiếu vẽ nên hạt mưa hơi xấu tý :(.
Source nằm trong file jar
Tải xuống mua.jar (3.48 KB)

Like: 0
avatar by Pham_loi Pham_loi
Chức vụ:
01:43:33, 27-05-2016

[Project phần mềm hello

Tự viết trên nền tản hello world. Cũng khá bựa
Tải xuống Hello.zip (3.74 KB)

Nguồn: wtai.

Like: 0
avatar by Pham_loi Pham_loi
Chức vụ:
01:42:53, 27-05-2016

di chuyển chạm vào vật

Tải Về mobileapplication3.jar (3 kb)
đính kèm là code, mình đã nén zip rồi vì thế ae ko phải kêu ca.

ko ai cmt ak mới vọc đc 1 ngày nên chỉ viết đc thế thui, hjx cơ mà ko pit mình đang làm cái j đây, tính viết ứng dụng mà mình ghét viết game.
Nguồn: gocvn
source.zip

Like: 0
avatar by Pham_loi Pham_loi
Chức vụ:
01:42:12, 27-05-2016

canvas di chuyển ảnh

đao về build lại r test vừa viết xong.
đây là ứng dụng test mình đã build.
Tải Về mobileapplication3.jar (3 kb)
code tập tin đính kèm.
Nguồn: gocvn.
src.rar

Like: 0
avatar by Pham_loi Pham_loi
Chức vụ:
01:41:06, 27-05-2016

Code cài đặt tốc độ và ánh sáng lúc khởi động mọi game

Code này mình viết để chèn vào ninjaschool nhưng nó thật sự chèn đc vào mọi game. Bạn chỉ cần chút thủ đoạn nhỏ để copy bytecode để xử lí 2 class 1chính và class cài speed
img
Source.zip
test.jar

Đã up bản fix tương thích mọi máy ảo kể cả các trình giả lập :*
Caitocdov31fixall.zip

Để dễ hình dung về cách chèn bytecode hay tải cái game đã chèn về vọoc. Be mình không pro nên không biết hướng dẫn thế nào :brick:
Tải xuống Ninja_999v7_Set_Speed_Server.zip (741.35 KB)
Nguồn: wtai

Like: 0
avatar by Pham_loi Pham_loi
Chức vụ:
01:40:30, 27-05-2016

project hỏi xoáy đáp xoay by NDAK
project build good nhưng so với code hơi chệch 1 tí tí
:hi:
Tải xuống srchoixoaydapxoay.zip (220.63 KB)

Like: 0
avatar by Pham_loi Pham_loi
Chức vụ:
01:39:37, 27-05-2016


soft của 1 bạn trong diển đàn nhưng không có code.
Tải xuống MyMidlet.zip (1.0 KB)
Nguồn: wtai.

Like: 0
avatar by Pham_loi Pham_loi
Chức vụ:
01:37:02, 27-05-2016

Tạo màn hình load game

bài này tôi sẽ hướng dẫn các bạn tạo màn hình loading game trong J2ME

Từ Netbeans các bạn tạo mới Project J2ME, chọn cấu hình CLDC 1.0 , MIDP 2.0 , chọn device là DefaultcldcMsaPhone1

ta xây dựng 3 lớp Point.java ,LoadingScreen.Java, và Midlet : MainMidlet.java

https://i1.wp.com/nzoqla.bay.livefilestore.com/y1pDN__w9A2oZzcNeFugWN0OSYMc83YYIy2qi9IzazO6O0e5Kngb80RBxdkyv-7RYRc5h80iXOZDZ23t4BoplTSfSQ_2eO3E1pO/j2me2.png

Lớp Point.java
<?php
package Zstar
;
 
/**
*
* @author zstar
*/
public class Point {
 
private 
int X 0;
private 
int Y 0;
 
public 
Point() {
}
 
public 
Point(int xint y) {
this.x;
this.y;
}
 
public 
int getX() {
return 
this.X;
}
 
public 
int getY() {
return 
this.Y;
}
}
?>

Copy code

Lớp LoadingScreen.java
<?php
package Zstar
;
 
import java.io.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.GameCanvas;
 
/**
* @author ZSTAR
*/
public class LoadingScreen extends GameCanvas {
 
private 
Graphics g;
private 
String logo "/Images/logo.png";
private 
String text1 "Game tiếng việt trên điện thoại";
private 
String text2 "Đang tải...";
private 
Image imageLogo;
private 
Point root = new Point(3050);
private 
Font fontNormal;
private 
Font fontBold;
//thanh loading
private int colorBorder 0x000000;
private 
int colorLoading 0xcc3301;
private 
int loadingLength 150;
private 
int loadingHeight 5;
private 
int loadingCurrent 0;
private 
int h 10;
private 
MainMidlet mainMidlet;
 
public 
LoadingScreen(MainMidlet main) {
super(false);
this.mainMidlet main;
this.this.getGraphics();
this.fontNormal g.getFont();
this.fontBold Font.getFont(Font.FACE_SYSTEMFont.STYLE_BOLDFont.SIZE_MEDIUM);
setFullScreenMode(true);
try {
imageLogo Image.createImage(logo);
} catch (
IOException ex) {
ex.printStackTrace();
}
this.root = new Point(getWidth() / imageLogo.getWidth() / 2root.getY());
 
}
 
public 
void start() {
clearScreen();
draw();
draw_next_loading();
}
 
public 
void draw() {
g.setColor(0x000000);
g.drawImage(imageLogoroot.getX(), root.getY(), Graphics.TOP Graphics.LEFT);
g.drawString(text1getWidth() / fontNormal.stringWidth(text1) / 2root.getY() + imageLogo.getHeight(), Graphics.TOP Graphics.LEFT);
g.setFont(fontBold);
g.drawString(text2getWidth() / fontBold.stringWidth(text2) / 2root.getY() + imageLogo.getHeight() + 40Graphics.TOP Graphics.LEFT);
g.setFont(fontNormal);
//draw loading
g.setColor(colorBorder);
g.drawRect(getWidth() / loadingLength 2root.getY() + imageLogo.getHeight() + 30loadingLengthloadingHeight);
g.setColor(colorLoading);
g.fillRect(getWidth() / loadingLength 2root.getY() + imageLogo.getHeight() + 30loadingCurrentloadingHeight);
g.setColor(colorBorder);
this.flushGraphics();
}
 
private 
void draw_next_loading() {
clearLoading();
//timer.schedule(task, interval,interval);
for (int i 0loadingLength hi++) {
if (
loadingCurrent loadingLength) {
loadingCurrent += h;
//draw loading
g.setColor(colorBorder);
g.drawRect(getWidth() / loadingLength 2root.getY() + imageLogo.getHeight() + 30loadingLengthloadingHeight);
g.setColor(colorLoading);
g.fillRect(getWidth() / loadingLength 2root.getY() + imageLogo.getHeight() + 30loadingCurrentloadingHeight);
g.setColor(colorBorder);
this.flushGraphics();
try {
Thread.sleep(100);
} catch (
Exception e) {
}
} else {
loadingCurrent 0;
break;
}
}
 
}
 
private 
void clearLoading() {
g.setColor(0xffffff);
g.fillRect(getWidth() / loadingLength 2root.getY() + imageLogo.getHeight() + 30loadingLengthloadingHeight);
this.flushGraphics();
}
 
public 
void clearScreen() {
g.setColor(0xffffff); // white
g.fillRect(00getWidth(), getHeight());
this.flushGraphics();
}
}
?>

Copy code

Lớp MainMidlet.java
các bạn thêm 1 midlet vào source package và code như sau
<?php
package Zstar
;
 
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.*;
 
/**
* @author ZSTAR
*/
public class MainMidlet extends MIDlet {
private 
LoadingScreen loadingScreen;
 
public 
void startApp() {
loadingScreen=new LoadingScreen(this);
Display.getDisplay(this).setCurrent(loadingScreen);
loadingScreen.start();
}
 
public 
void pauseApp() {
}
 
public 
void destroyApp(boolean unconditional) {
}
}
?>

Copy code


Nhấn F6 để chạy ứng dụng ta được kết quả :

img

Like: 0
avatar by Pham_loi Pham_loi
Chức vụ:
01:33:41, 27-05-2016

Tạo menu lựa chọn game

bài này tôi sẽ hướng dẫn các bạn tạo menu với các lựa chọn trong J2ME

tạo lớp Point.java
<?php
package Zstar
;
 
import javax.microedition.xml.rpc.Operation;
 
/**
*
* @author zstar
*/
public class Point {
 
private 
int X 0;
private 
int Y 0;
 
public 
Point() {
}
 
public 
Point(int xint y) {
this.x;
this.y;
}
 
public 
int getX() {
return 
this.X;
}
 
public 
int getY() {
return 
this.Y;
}
}
?>

Copy code

tạo lớp Menu.java kế thừa từ GameCanvas
<?php
package Zstar
.menu;
 
import Zstar.Point;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
 
/**
*
* @author ZSTAR
*/
 
public class Menu extends GameCanvas {
 
private 
Stringoptions = {"New Game""Map Editor""High Score""About""Exit"};
private 
Point locationMenu = new Point(3030);
private 
int itemWidth;
private 
int item_space 15;
private 
Image itemSelect;
private 
Image itemUnselect;
private 
Graphics g;
private 
int itemHeight;
private 
int currentIndex 0;
private 
int white 0xffffff;
private 
int black 0x000000;
private 
Font font;
 
public 
Menu() {
super(false);
setFullScreenMode(true);
try {
this.this.getGraphics();
itemSelect Image.createImage("/Images/butoption_Press.png");
itemUnselect Image.createImage("/Images/butoption_unPress.png");
this.itemHeight itemSelect.getHeight();
this.itemWidth itemUnselect.getWidth();
this.font Font.getFont(Font.STYLE_ITALICFont.FACE_SYSTEMFont.SIZE_SMALL);
this.locationMenu = new Point(this.getWidth() / this.itemWidth 2this.locationMenu.getY());
g.setFont(font);
} catch (
Exception e) {
};
}
 
public 
void Draw() {
for (
int i 0options.lengthi++) {
if (
currentIndex == i) {
g.drawImage(itemSelectlocationMenu.getX(), locationMenu.getY() + itemHeight item_spaceGraphics.LEFT Graphics.TOP);
 
} else {
g.drawImage(itemUnselectlocationMenu.getX(), locationMenu.getY() + itemHeight item_spaceGraphics.LEFT Graphics.TOP);
}
g.drawString((1) + ". " options[ilocationMenu.getX() + 15locationMenu.getY() + itemHeight item_space 5Graphics.TOP Graphics.LEFT);
this.flushGraphics();
}
}
 
private 
void clear_Item(int i) {
g.setColor(this.white);
g.fillRect(locationMenu.getX(), locationMenu.getY() + itemHeight item_spaceitemWidthitemHeight);
g.drawImage(itemUnselectlocationMenu.getX(), locationMenu.getY() + itemHeight item_spaceGraphics.LEFT Graphics.TOP);
g.setColor(this.black);
g.drawString((1) + ". " options[ilocationMenu.getX() + 15locationMenu.getY() + itemHeight item_space 5Graphics.TOP Graphics.LEFT);
 
flushGraphics();
}
 
private 
void Draw_nextItem(int i) {
clear_Item(i);
g.drawImage(itemSelectlocationMenu.getX(), locationMenu.getY() + itemHeight item_spaceGraphics.LEFT Graphics.TOP);
g.drawString((1) + ". " options[ilocationMenu.getX() + 15locationMenu.getY() + itemHeight item_space 5Graphics.TOP Graphics.LEFT);
flushGraphics();
}
 
public 
void keyPressed(int keyCode) {
switch (
getGameAction(keyCode)) {
case 
UP:
clear_Item(currentIndex);
menuSelectChange(-1);
Draw_nextItem(currentIndex);
break;
case 
DOWN:
clear_Item(currentIndex);
menuSelectChange(1);
Draw_nextItem(currentIndex);
break;
case 
FIRE:
//xu ly khi chon
;
break;
}
}
 
private 
void menuSelectChange(int h) {
//viec lua chon menu se chay vong tron
currentIndex += options.length;
currentIndex currentIndex options.length;
}
}
?>

Copy code

Tạo 1 Midlet để test menu như sau

<?php
package Zstar
;
 
import Zstar.menu.*;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.*;
 
/**
* @author ZSTAR
*/
public class MenuMidlet extends MIDlet {
private 
Menu menu;
 
public 
void startApp() {
menu=new Menu();
menu.Draw();
Display.getDisplay(this).setCurrent(menu);
}
 
public 
void pauseApp() {
}
 
public 
void destroyApp(boolean unconditional) {
}
}
?>

Copy code

kết quả :

img
menu sẽ được chọn khi bấm phím up,down

chúc các bạn vui vẻ

Like: 0
Lên trên  Tổng số: 15
« 1 2 »







Trực Tuyến: Khách: 1
Diễn đàn teen Việt Nam
CopyRight 2014