You Are Here:

Community: Developer Discussion Boards

#1 Old animating object without repainting background - 2004-03-25, 04:41

Join Date: Mar 2003
Posts: 49
yonan32
Offline
Registered User
hi, does anyone have any idea how to animate a graphic object or text across the screen without having to repainting the background? cos on my paint() method there's a lot of logic happening, and i dont want to call all of them.
Reply With Quote

#2 Old 2004-03-25, 10:02

Join Date: Mar 2003
Posts: 2,280
Location: Israel
shmoove
Offline
Forum Nokia Champion
There's no magic involved. If you don't want to repaint the whole background you don't have to, but you do have to repaint the part that was hidden behind the object in the initial frame. So you need to keep track of the objects old position (that's easy), and find a way to just repaint the part that was covered by the object (that can be quite tricky, depending on the game). Another approach can be to save the background (all the objects that don't move and are behind the moving objects) in an image and paint that image instead of redoing all the logic needed to create it.

shmoove
Reply With Quote

#3 Old 2004-03-26, 05:36

Join Date: Mar 2004
Posts: 2,077
Location: Bangalore,India
Send a message via MSN to mayankkedia Send a message via Yahoo to mayankkedia
mayankkedia's Avatar
mayankkedia
Offline
Forum Nokia Champion
hi..
why dont u try using flags and put all the things that u dont want to repaint in the else() block and only paint that part which u want to animate in the if()block..??
something like...:-
public void paint(Graphics g)
{
if(flag)
{
animate;
}
else
{
dont animate;
}
}
in the non animate part u can specify the clip area as well so that the entire area doesnt have to be repainted.
as far as i know there is no other way to animate without calling the paint().
Cheers
Reply With Quote

#4 Old 2004-03-26, 10:02

Join Date: Jun 2003
Posts: 75
fabiolee
Offline
Regular Contributor
u can use "repaint(x,y,w,h);" repaint the area that u want to only.
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia