08-24-2003, 11:34 AM
08-24-2003, 04:24 PM
That's "welcome"...
npc.x(n) = npc.x(n)-1
npc.y(n) = npc.y(n)+1
npc.x(n) = npc.x(n)-1
npc.y(n) = npc.y(n)+1
08-25-2003, 07:50 AM
war is peace, 1984
08-25-2003, 04:36 PM
Define a Type for all your npc's like this one:
Then define your npc like:
And you're ready to use your npc type.
And by messing and comparing with the x and y values of both the user and the npc you can find out if the user if close to the npc.
Code:
TYPE NPCtype
X AS SINGLE
Y AS SINGLE
vX AS SINGLE
vY AS SINGLE
Text AS STRING * 32
iD AS INTEGER
wid AS INTEGER
hei AS INTEGER
END TYPE
Then define your npc like:
Code:
DIM npc AS NPCtype
And by messing and comparing with the x and y values of both the user and the npc you can find out if the user if close to the npc.
08-25-2003, 10:39 PM
could you explain the type thing. i get what it does. is just for Convenience? this is what i'm using to move the guy around. it's nnot good but it's all i can think of
Code:
FOR enemyx = 5 TO 11
PUT (enemyx * 15 - 15, enemyy * 13 - 13), enemysh, AND
PUT (enemyx * 15 - 15, enemyy * 13 - 13), enemy, OR
oldx = enemyx
FOR i = 1 TO 100000: NEXT
PUT (oldx * 15 - 15, enemyy * 13 - 13), tile2, PSET
NEXT
FOR enemyy = 5 TO 7
PUT (enemyx * 15 - 15, enemyy * 13 - 13), enemysh, AND
PUT (enemyx * 15 - 15, enemyy * 13 - 13), enemy, OR
oldy = enemyy
FOR i = 1 TO 100000: NEXT
PUT (enemyx * 15 - 15, oldy * 13 - 13), tile2, PSET
NEXT
FOR enemyx = 11 TO 5 STEP -1
PUT (enemyx * 15 - 15, enemyy * 13 - 13), enemysh, AND
PUT (enemyx * 15 - 15, enemyy * 13 - 13), enemy, OR
oldx = enemyx
FOR i = 1 TO 100000: NEXT
PUT (oldx * 15 - 15, enemyy * 13 - 13), tile2, PSET
NEXT
FOR enemyy = 7 TO 5 STEP -1
PUT (enemyx * 15 - 15, enemyy * 13 - 13), enemysh, AND
PUT (enemyx * 15 - 15, enemyy * 13 - 13), enemy, OR
oldy = enemyy
FOR i = 1 TO 100000: NEXT
PUT (enemyx * 15 - 15, oldy * 13 - 13), tile2, PSET
NEXT
08-26-2003, 03:28 AM
it's to make the code readable.
08-26-2003, 03:54 AM
In qb, TYPEs serve no real purpose. TYPEs are like the XP-type search mechanism: search for images, documents, music files? What was the color of that file? Did it have a cupcake in it...?
TYPEs try to enforce some sort of order on your variables. If you don't have that order in your head in the first place though, types won't help. But they WILL hurt, as type variable arrays are invoked differently than real arrays, and they have limitations when real arrays with the same name are used.
TYPEs try to enforce some sort of order on your variables. If you don't have that order in your head in the first place though, types won't help. But they WILL hurt, as type variable arrays are invoked differently than real arrays, and they have limitations when real arrays with the same name are used.
08-26-2003, 04:34 AM
can you just use ! # $ %
what's the difference?
what's the difference?
08-26-2003, 04:55 AM
Agamemnus is always wrong when he talks about types, 'cause he hates'em LOL j/k
Types are useful to pass a bunch of related variables to a function just with 1 parameter, for example.
Types are useful to pass a bunch of related variables to a function just with 1 parameter, for example.
08-26-2003, 05:19 AM
does it run faster?