LoginLogin

Grid help?

Root / Programming Questions / [.]

zagg2000Created:
I need to know how to code a grid using the touch screen, so when i touch a square, in the grid, it'll place a wight block! [dosnt matter if its a BG or SP] Also, i need to be able to count how many there are on screen, and it needs to be in a value such as 1 or 2 if theres 1 or 2 on screen.

use TOUCH OUT timevariable,xvariable,yvariable this sets 3 variables to the time and location of the touch if the time is not 0, the screen is being touched.

Thanks but thats not what im asking about.

Thanks but thats not what im asking about.
You're gonna need TOUCH OUT to make this regardless.

Thanks but thats not what im asking about.
You're gonna need TOUCH OUT to make this regardless.
yeah i know. can you help?

for a grid of 8x8 squares (for example) you would convert the touch coordinates like this: gridX=touchX DIV 8 * 8 gridY=touchY DIV 8 * 8 keeping track of how many squares exist is simple, just add 1 to a variable every time you create a square, and subtract 1 if you remove a square

for a grid of 8x8 squares (for example) you would convert the touch coordinates like this: gridX=touchX DIV 8 * 8 gridY=touchY DIV 8 * 8 keeping track of how many squares exist is simple, just add 1 to a variable every time you create a square, and subtract 1 if you remove a square
I'll try it. thanks man.

for a grid of 8x8 squares (for example) you would convert the touch coordinates like this: gridX=touchX DIV 8 * 8 gridY=touchY DIV 8 * 8 keeping track of how many squares exist is simple, just add 1 to a variable every time you create a square, and subtract 1 if you remove a square
Whats gridX For?

the start of the square, it's always a multiple of 8

for a grid of 8x8 squares (for example) you would convert the touch coordinates like this: gridX=touchX DIV 8 * 8 gridY=touchY DIV 8 * 8 keeping track of how many squares exist is simple, just add 1 to a variable every time you create a square, and subtract 1 if you remove a square
i got that, but how do i place multiple SPRITE'S?

It might be easier to use PRINT (there is a block character) instead of sprites or bg. Also, I would recommend using a 2-D array to keep track of which part of the grid has been touched. I have a program like this if you want to look at it.

sure! as long as its easy to understand.

I haven't looked at this in a while, but here it is: ZSDNE384. Sorry about the late reply.

key dose not wotk

"7SDNE384" Sorry about the typo. Midterms=not much sleep-> brain thinks 7 is Z.