Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
reading a pixel in a put array
#1
okay, for my collision detection, i basically draw a small box around my player. i also have a layer for collision detection. to detect whether the player has collided with a wall or something, i check to see if the box the player is in has collided with colour in a certain tile in the collision layer. however, it's very buggy when it works, sometimes preventing you to pass through and then letting you through a bit further down. i believe it's the code i use to read a pixel in an array that's the problem though... tests have pretty much confirmed it. here's the code i have...

Code:
FUNCTION getpcolor (tilearray(),tbt,x,y)

def seg = VARSEG(tilearray(tbt))

temparray = PEEK(VARPTR(tilearray(tbt + 2)) + x + y * 320)
getpcolor = temparray

END FUNCTION

when i try drawing one of my collision tiles using this function, the tiles i get drawn are not what they're supposed to be like, i think this piece of code is the problem... any suggestions?
Jumping Jahoolipers!
Reply
#2
btw congrats on your 500 post
earn.
Reply
#3
500 post? oh, wait! 500! yay! gotta celebrate... but how? Wait, with smilie fest!


Big Grin Big Grin Big Grin Big Grin
Big Grin Big Grin Big Grin Big Grin
Big Grin Big Grin Big Grin Big Grin
Big Grin Big Grin Big Grin Big Grin

:bounce: :bounce: :bounce: :bounce:
:bounce: :bounce: :bounce: :bounce:
:bounce: :bounce: :bounce: :bounce:
:bounce: :bounce: :bounce: :bounce:
Jumping Jahoolipers!
Reply
#4
good flippin idea man, ill must do the same. btw wheres the NOD smiey
earn.
Reply
#5
Code:
temparray = PEEK(VARPTR(tilearray(tbt + 2)) + x + y * 320)

Unless the width of your sprite isn't 320, the above ain't gonna work.

Code:
Arraywidth=tileArray(Tbt)
temparray = PEEK(VARPTR(tilearray(tbt + 2)) + x + y * arraywidth)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#6
ooooh!!! aaarrrghhh! it's so simple... how could i miss it? it's just not one of my better days.. just give me a minute while i go beat myself up for missing that...

:oops:

thank you relsoft!!!
Jumping Jahoolipers!
Reply
#7
Quote:good flippin idea man, ill must do the same. btw wheres the NOD smiey

click the View more emoticons on the left side of the 'post a reply'
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)