Quick Questions

Blitz3D Forums/Blitz3D Beginners Area/Quick Questions

LKFX(Posted 2005) [#1]
I have a basic fps engine going at the mo but cant seem to make "collectables" is it possble to like leave a sprite near the floor(medipak) and make the player pick it up as he goes over it? being trying but best i got was that the player got stuck next to it (sliding).

And whats the best way to create windows in a building any ideas, i have cs4 but i prefer maplet.

any help would be appreciated.

thanks


lo-tekk(Posted 2005) [#2]
Check out the EntityCollided command in the helpfile.
Something like this:

If CountCollisions ( player)
  entity = EntityCollided ( player,medipak )
     If entity
	make something with your medipak
     EndIf
EndIf


http://www.moonworx.de


Rook Zimbabwe(Posted 2005) [#3]
Quick note: Title your topic with the issue not a nebulos title...


LKFX(Posted 2005) [#4]
Must be doing something wrong still wont work, the sliding collision works on it.


WolRon(Posted 2005) [#5]
Collisions cause a collision reaction to occur. According to your example, this is probably not what you want.

I think what you are looking for is the EntityDistance or LinePick commands...


lo-tekk(Posted 2005) [#6]
Maybe you can post some of your code to look it over.

http://www.moonworx.de


jfk EO-11110(Posted 2005) [#7]
Simply check Entitydistance from player to item - don't use collsion with the item.
example given:
Le's assume you have an array of medipack meshes...
...
for i=0 to num_medi-1
 if medipack(i)<>0
  if entitydistance(player,medipack(i))<mindist# then
   health=health+100
   freeentity medipack(i)
   medipack(i)=0
  endif
 endif
next

To prevent pickin things trough walls you may add a entityvisible check after the Distance check. To make Entitysisible work, you need to set the right entitypickmode for the entities. eg entitypickmode medipack(i),2 after loading the mesh.


LKFX(Posted 2005) [#8]
Thanks chaps entitydistance works a treat.

With all my collectables (medikits,ammo etc..) whats the best method of placing these items in my level i use maplet to build the maps, it would take ages getting the coords for them and typing it into blitz?

any ideas


LKFX(Posted 2005) [#9]
for i=0 to num_medi-1
if medipack(i)<>0
if entitydistance(player,medipack(i))<mindist# then
health=health+100
freeentity medipack(i)
medipack(i)=0
endif
endif
next

With this code how do i check to see if the entity exsists before i delete it?