whole BG

Forum for J2ME mobile games related topics including programming doubts, books and other resources for J2ME game development

Re: whole BG

Postby DevelopmentTeam » Tue Jul 29, 2008 6:30 am

We will take a look at the game, and if you can send the code by email, we will fix the problem in this case. Will get back to you shortly.
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: whole BG

Postby DevelopmentTeam » Tue Jul 29, 2008 9:12 am

We saw the jar file and the bg seems to be moving fine but the problem is that bg is moving faster than the player. that is the problem with the jar file. The code you sent was not working and we were not able to compile it and run without error. So all you have to do now is make the bg slow and move it with the tiles. like the orange platform.
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: whole BG

Postby rahul7star » Tue Jul 29, 2008 3:50 pm

Hi should i send u that code again.........??

my problm is i want somethng like mario scroll BG ...in my code same BG is replicating ..i dont want that...i want diff BG wenever this.x>170....
rahul7star
Regular User
 
Posts: 84
Joined: Fri Aug 17, 2007 11:22 am

Re: whole BG

Postby DevelopmentTeam » Wed Jul 30, 2008 4:28 am

In case you have to change the bg in the runtime, try using the tile layer and bring the bg within the layer that you are using for the platform. Otherwise load a new image after some point the player has moved.
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: whole BG

Postby rahul7star » Wed Jul 30, 2008 6:15 am

Hi
i had sent you souce code ...can you modofy that code with TileLayer Bg concept.....so that tile can be moved while player is moving


Thanks
rahul7star
Regular User
 
Posts: 84
Joined: Fri Aug 17, 2007 11:22 am

Re: whole BG

Postby DevelopmentTeam » Wed Jul 30, 2008 10:10 am

The code you sent is not self explanatory and we need to put more time to fix it. I think you ca try it your self with our idea.
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: whole BG

Postby rahul7star » Mon Aug 04, 2008 8:55 am

HI

well i dont want to move my player.....i want only bg to rotate.....

this.sprite.setPosition( this.x, this.y ) ; is used for incresing /dec player position ,...m using this.x+=this.step wer step=4;


for(int i = -this.x ; i <getWidth(); i += image.getWidth())
{
this.gContext.drawImage(image, i,0,0);
if(i>getWidth())
{
i=0;
}
} for moving BG.....

now can u tell me how to move only BG but not player.....
rahul7star
Regular User
 
Posts: 84
Joined: Fri Aug 17, 2007 11:22 am

Re: whole BG

Postby DevelopmentTeam » Mon Aug 04, 2008 9:23 am

If you can read the whole thread again once or twice, you can see my replies for the same question atleast 3 times. Please read it again.
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: whole BG

Postby rahul7star » Mon Aug 04, 2008 10:11 am

HI ok ....thanks

Now ...look i had writen jump code..now wenever it collide with that image..it will stop...but still collison is not dat effective..sometime player collides from its center part and sometime from bottm ..
here is jump code
////////
if(this.jumping)
{ this.y=this.y-this.jump;

this.jump = this.jump-1;
if(this.jump<-10)
{
this.jump=-10;
}

if(sprite.collidesWith(bgSprite,true)||sprite.collidesWith(bgSprite1,true)||sprite.collidesWith(bgSprite2,true)||sprite.collidesWith(bgSprite3,true)||sprite.collidesWith(bgSprite4,true) )

{
this.jump=0;
if(Flag==1)
{
this.jump=11;
Flag=0;


}


else
{
Flag=0;
}


}
}

///////////// Flag=1 wen UP key is pressed....
rahul7star
Regular User
 
Posts: 84
Joined: Fri Aug 17, 2007 11:22 am

Re: whole BG

Postby rahul7star » Mon Aug 04, 2008 10:16 am

see this
Attachments
jump.png
jump.png (9.35 KiB) Viewed 3814 times
rahul7star
Regular User
 
Posts: 84
Joined: Fri Aug 17, 2007 11:22 am

Re: whole BG

Postby DevelopmentTeam » Mon Aug 04, 2008 10:55 am

What there in the picture?
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: whole BG

Postby rahul7star » Mon Aug 04, 2008 11:04 am

i sent u jar file plz chk that wenevr player is jumping collision is not proper
rahul7star
Regular User
 
Posts: 84
Joined: Fri Aug 17, 2007 11:22 am

Re: whole BG

Postby DevelopmentTeam » Mon Aug 04, 2008 11:16 am

We'll check and get back to you...
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

Re: whole BG

Postby rahul7star » Tue Aug 05, 2008 3:36 pm

Hi

Have you chked dat jar file......well i need to ask some more thngs as i m confused like..

1)
for (int y = 0; y < getHeight(); y += back.getHeight()) {
for (int x = 0; x < getWidth(); x += back.getWidth()) {
g.drawImage(back, x, y, 0);
}
}

question--> whats this is doing y += back.getHeight()

2)is collideWith function is really not gud for collsion ...if possible can u share me perfect colsion sample
rahul7star
Regular User
 
Posts: 84
Joined: Fri Aug 17, 2007 11:22 am

Re: whole BG

Postby DevelopmentTeam » Wed Aug 06, 2008 6:00 am

rahul7star wrote:Hi

Have you chked dat jar file......well i need to ask some more thngs as i m confused like..

1)
for (int y = 0; y < getHeight(); y += back.getHeight()) {
for (int x = 0; x < getWidth(); x += back.getWidth()) {
g.drawImage(back, x, y, 0);
}
}

question--> whats this is doing y += back.getHeight()

2)is collideWith function is really not gud for collsion ...if possible can u share me perfect colsion sample


We didnt check your file yet...

1) back.getHeight() is the height of the image file and the variable y is incremented with this value every time the loop is executed.

2) The basic collision detection logic is slow in most mobile when the game is little complected. we would better prefer to write your own collision detection code specifically for this game. Using any general collision detection classes are definitely CPU hungry.
User avatar
DevelopmentTeam
Site Admin
 
Posts: 661
Joined: Tue Aug 15, 2006 8:39 am
Location: India

PreviousNext

Return to J2ME Games

Who is online

Users browsing this forum: No registered users and 1 guest

cron