Author Topic: Problem with parallax engine  (Read 4901 times)

0 Members and 1 Guest are viewing this topic.

Sniped50

  • Sapling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 97
  • Don't ask. About anything.
Re: Problem with parallax engine
« Reply #45 on: February 04, 2011, 05:28:57 PM »
Is it possible to make an if check in LevelSetup()? And would drawing the stars before the asteroids would in fact mean the stars will always be hidden behind asteroids, no matter what happens before/after?

If so, I have an idea; a longshot, but an idea nonetheless.

If not, forget I ever got your hopes up... :P


Oh, and Widget, yes it's possible that fewer, larger tables could be more efficient; it's like saying one 10kb file is better than five 2kb files, because despite both sets of files containing the same amount of info, you aren't forced to flick between files searching for what you want. But in the end, it doesn't really help with something like this because it's still storing the same amount of information no matter which choice you pick.
"Sometimes, the simplest solutions work the best."
- Mythbusters

"But the complex solutions look prettier."
- Me

Pilchard123

  • Tester
  • Old Oak
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 17
  • Posts: 899
  • Eufloria: Yes
Re: Problem with parallax engine
« Reply #46 on: February 05, 2011, 01:38:27 PM »
I don't know how reliable it is, but I have a speed-tester for my code snippets. I'll run it a few times and tell you the results. You want me to post the tester too? Perhaps you can use it, or help me improve it.

EDIT: It reports no apreciable difference when either i = 50, j = 500    or when i = 500, j = 50, both take approx 0.64 seconds, with no difference in the output time at 15 dp.

Tester attached, set up with i=5000,j=50000. I know it says WHILE tester, but I can't be bothered to change it. If you want a while loop rather than a for loop, then either work it out, or ask here, athough to be honest, if you're worried about codespeed, then you probably are good enough to cope on your own. No offence meant.
« Last Edit: February 05, 2011, 02:05:39 PM by Pilchard123 »

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Problem with parallax engine
« Reply #47 on: February 05, 2011, 02:03:33 PM »
Is it possible to make an if check in LevelSetup()? And would drawing the stars before the asteroids would in fact mean the stars will always be hidden behind asteroids, no matter what happens before/after?

Yeah you can use "if" in LevelSetup.  You can use it anywhere you like.. :>

I have no control over whether the stars or the asteroids are drawn first; that's the whole point.  It's not simply a case of which function appears in the level file first.  It would need to be changed by Alex or something.

I think it would make sense to make that change, personally.  Drawings of all kinds are less flexible if you can't choose whether they appear behind an asteroid or in front of it..

Sniped50

  • Sapling
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 97
  • Don't ask. About anything.
Re: Problem with parallax engine
« Reply #48 on: February 05, 2011, 10:51:32 PM »
Well...

I've thought about and tweaked my idea: why don't you have a new function that you can call at the end of LevelDraw, once it has finished with what it was doing? That way, LevelSetup initiates the global variables first, then LevelDraw gets to work with the stars, then at the end of that, a third function, which could be called something like AsteroidDraw(), is initiliased containing all the asteroid variables, rather than have them in LevelSetup.

Then you'll be sure that the stars are drawn before the asteroids. Now, either it will work beautifully 8), it will destroy Eufloria :-[, I'm rubbish at coding ::), or you've already tried that :( . Which would it be...?
"Sometimes, the simplest solutions work the best."
- Mythbusters

"But the complex solutions look prettier."
- Me

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Problem with parallax engine
« Reply #49 on: February 06, 2011, 12:42:00 AM »
It doesn't matter where the asteroids are declared, it's the order in which asteroids and draws are rendered to the screen. Don't think it will work unfortunately.. But if you can find a way to draw ANY sprite such that it's rendered behind astroida, I'd be interested to know how you did it. :>

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Problem with parallax engine
« Reply #50 on: February 06, 2011, 02:08:41 AM »
Hey, I wonder if I can just draw an asteroid sprite on top of all the asteroids...

Hmm, it might hide the roots though...

annikk.exe

  • Achiever
  • Ent
  • ****
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1,794
Re: Problem with parallax engine
« Reply #51 on: February 06, 2011, 02:21:35 AM »
Ok, seems like drawings ALWAYS appear on top of each other, regardless of the order the commands appear in.  So that approach won't work.  :<