Topic: 2.5D side scrooling lanscape ain't running smooth.. (Page 1 of 1) |
|
---|---|
Nervous Wreck (II) Inmate From: |
posted 07-27-2009 19:59
I've made this little thingy in JavaScript that I'm going to use in a game. But it's running pretty laggy N' slow.. |
Nervous Wreck (II) Inmate From: |
posted 07-27-2009 21:37
By changing: code: var bgpos1=0; var bgpos2=0; var bgpos3=0; document.onload function background() { document.getElementById('background1').style.backgroundPosition=bgpos1+"px 0px"; document.getElementById('background2').style.backgroundPosition=bgpos2+"px 0px"; document.getElementById('background3').style.backgroundPosition=bgpos3+"px 0px"; bgpos1-=0.7; if (bgpos1<=0) { bgpos1=1000 } bgpos2-=0.4; if (bgpos2<=0) { bgpos2=850 } bgpos3-=0.1; if (bgpos3<=0) { bgpos3=700 } }
code: var bgpos1=1000/0.7; var bgpos2=850/0.4; var bgpos3=700/0.2; document.onload function background() { document.getElementById('background1').style.backgroundPosition=bgpos1*0.7+"px 0px"; document.getElementById('background2').style.backgroundPosition=bgpos2*0.4+"px 0px"; document.getElementById('background3').style.backgroundPosition=bgpos3*0.2+"px 0px"; bgpos1--; if (bgpos1<=0) { bgpos1=1000/0.7; } bgpos2--; if (bgpos2<=0) { bgpos2=850/0.4; } bgpos3--; if (bgpos3<=0) { bgpos3=700/0.2; } }
|
Maniac (V) Inmate From: zero divided. |
posted 07-27-2009 21:45
Ooh! Retro parallax scrolling! That brings back good gaming memories. |
Nervous Wreck (II) Inmate From: |
posted 07-27-2009 22:48
I'm glad you think so cuzz I'm accutually trying to get a retro feel |
Paranoid (IV) Inmate From: Norway |
posted 07-27-2009 22:58
White Hawk: Like November 20lines Javascript Contest - Arcade Scrollers - Comments ? |
Nervous Wreck (II) Inmate From: |
posted 07-27-2009 23:59
Thanks poi. |
Paranoid (IV) Inmate From: Norway |
posted 07-28-2009 00:11 |
Neurotic (0) Inmate Newly admitted From: |
posted 07-28-2009 14:09
we are providing [Edit TP: Spam url removed. Thank your for spaming.] information to interested hookah smokers to experience the true pleasures. |
Lunatic (VI) Mad Scientist From: The Happy Hunting Grounds... |
posted 07-28-2009 16:54
quote:
|
Nervous Wreck (II) Inmate From: |
posted 07-29-2009 21:49
Thanks poi! I didn't saw the link. I'm going to check out the source for Shadow of the Beast it looks pretty cool |
Obsessive-Compulsive (I) Inmate From: |
posted 08-07-2009 15:30
Ahh, so simple but looks excellent. I love parallax style stuff. |
Nervous Wreck (II) Inmate From: |
posted 05-31-2011 11:07
Edit TP: spam removed
|