Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Nested For Loop... An interesting problem!

Author
Message
Adam_db
17
Years of Service
User Offline
Joined: 28th Feb 2007
Location:
Posted: 30th Jul 2007 00:02
what i want my program to do is simply draw a series of sprites, in an order along an imaginary \'shelf\' starting from 0,0, right next to each other. each image is 78 x 149 in size. and i am using the dimensions themselves to determine the position with my nested for loops.

this is my code, i dont understand why these images are all being displayed on top of each other.



----------------------------------------------------
Just because they are paranoid, doesnt mean they arent out to get you.
Jane Doe
17
Years of Service
User Offline
Joined: 29th Jun 2007
Location:
Posted: 30th Jul 2007 01:21
1. You don't have to load the same image three times. Just load it once.

2. You need to get rid of the backslashes in your image name. Only use them to specify a path to another directory.

3. The problem you're asking about is being caused by using the same variable name for two different purposes in your SPRITE command:

SPRITE temp, tempx, tempy, temp

The first "temp" is the sprite number. The second "temp" is the image number. You need to use two different variables.

- Jane
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 30th Jul 2007 02:28
Quote: "You need to get rid of the backslashes in your image name. Only use them to specify a path to another directory."

That's actually a forum error. It seems to happen at random.

The image number shouldn't need to be a variable if you want to use the same image for all of them. Just put a number there.

Jane Doe
17
Years of Service
User Offline
Joined: 29th Jun 2007
Location:
Posted: 30th Jul 2007 07:10
This should sort you out:



- Jane
Adam_db
17
Years of Service
User Offline
Joined: 28th Feb 2007
Location:
Posted: 2nd Aug 2007 15:56
Thanks Jane, that did the trick.

----------------------------------------------------
Just because they are paranoid, doesnt mean they arent out to get you.

Login to post a reply

Server time is: 2024-09-27 02:30:45
Your offset time is: 2024-09-27 02:30:45