Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - MrPlow

#1771
Excellent!!

Love the editors and the code usage!
Hmmm New Toys!!!! :whip:
#1772
hi,

Use Debug <value> + "\n" to output the values for testing.

Also,
It's very similar in function to MS Access Debugging so If you read up on that you might get some good tips!
:booze:
#1773
Great stuff! Thanks guys...
Will have a go with this soon!

Are 8x8 or 16x16 tiles the most common?
What is best to suit both Android & iPhone? Or does it even matter?
#1774
Hi,

I will be looking to do this shortly and wondered if there was a simple enough approach to making a scrolling screen containing a lot of sprite objects.

I could have the screen reset and show a new screen when the main sprite hits the borders but I want a smooth scrolling screen if possible...

Would I have to iterate thru the sprite x,y coords and update to simulate a scrolling effect?
I think this method would be heavy on CPU and cause a bad flicker.

Any other ideas?

G
#1775
I got it working !!

My calcs were wrong... my x and y of the sprite were correct (odd numbers)
but my waters sections x (odd) y(even)

So along the way I evened out a 'y' axis value.

I really need to use my debugger better from now on!!

Thanks Guys!
#1776
Thanks Kitty,

But I am still a bit confused because...
I kinda do that with the current array except the block are multiples of the 16 x 16 sizes.

So a block could be 64 x 32, or 128 x 32 etc...

I then step through the screen in 16 x 16 blocks
which is like the [100][100] as x,y are divided by 16px simulating the screen as a 16x16 grided area.

When I collide I find that I need to loop through the whole array once again to test against the position before the collision and to the left and right of the 32x32 block (2 x 16px blocks)


I will try to explain in a diagram

B = My Sprite Block 32 x 32
W = Water sections in arrays with height of 32 but width varies in mulples of 16

B moves down 16px then accross from far left in blocks of 16 until it collides

START:
                             B

                     WWW
                WWWWWWWWWWWWWWWWW

COLLISION DETECTED:           

                     BWWW
                WWWWWWWWWWWWWWWWW

COLLISION ITEM IS MOVED UP AND PLACED IN POSITION:           
                      B
                     WWW
                WWWWWWWWWWWWWWWWW

HOWEVER THE IDEAL POSITION IN ABOVE IS:

                     
                     WWW     B
                WWWWWWWWWWWWWWWWW

This is due to having adequate water below and space above in equal measure...
So the collision is reversed and areas around need to be checked for collisions and empty squares...

Its finding the solution to this problem that I am struggling with...

:noggin:
G

#1777
Hi,

I have a screen divided in to 16x16 sections

Using for loops that are stepped by 16 from 1 to 800 and 1 to 512 (high)

An array of an objects is placed within the confines of the grid by a measure of 16x16 squares or a multiple of the same...

But the item I move around the screen (also 16x16) is not flush with some sections of the sprite array and every second section of the grid is out or incorrectly...any ideas??

Code (glbasic) Select
FUNCTION hitobject: xx,yy

FOREACH w IN waters[]

IF BOXCOLL(xx,yy,16,16,w.wx,w.wy,w.width,w.height) THEN RETURN 1
NEXT


ENDFUNCTION



#1778
Bump!
Next help!
#1779
Hi,

thanks, in that case i shall post a bit of code...
What I am trying to do place an object next to a body of objects providing the 32x32 sections on either side of the object are free from other objects...
I think this is simple enough but am getting my approach wrong...

Code (glbasic) Select
LOADSPRITE "castle1.png", 11
result% = 0


FOR f=1 TO 512 STEP 16

FOR n = 1 TO 800 STEP 16

//FOREACH test IN waters[]
FOR i = 0 TO BOUNDS(waters[],0)-1


// IF BOXCOLL (test.wx, test.wy,test.width,32, n,f,32,32)
IF BOXCOLL (waters[i].wx, waters[i].wy,waters[i].width,32, n,f,32,32)


// TEST SIDE SECTIONS
FOREACH leftside IN waters[]

IF BOXCOLL (leftside.wx, leftside.wy,leftside.width,32, n-32,f-16,32,32)=FALSE AND BOXCOLL (leftside.wx, leftside.wy,leftside.width,32, n+64,f-16,32,32)=FALSE



result = 1

ELSE
result = 0
ENDIF

NEXT

IF result = 1

DRAWSPRITE 11, n, f-16


GOTO scr1

ENDIF

ENDIF

NEXT

NEXT

NEXT
#1780
GLBasic - en / Collisions
2011-Nov-03
Hi,

I have a problem with my collision detections...

I have code (not at hand right now...) written that looks for box collision item against an array of items ... by iterating through screen section in blocks of 16 pxls

When it finds the item the collision should revert back to pre position and then validate that the 32 pixels of either side of the 32 px box is collision free before continuing....

Hope i made myself clear...

I expect that using array objects is the only collision method and that useasbmp and current pixel colouring cannot be checked to provide an alternative?

Checking the colour of pixels as test would be a nice way based on the useasbmp so that 100s of arrays do not need to be examined...

G.