here you are, sorry if it took too long
[edit]wow, exactly 1 hour
[/edit]
i have the
remstart
-------------------------------------------------------------------
program name: How To Create Bulletholes
-------------------------------------------------------------------
written by: Lukas W
date: 2. Oct. 2005
-------------------------------------------------------------------
comments: Using Sparkys Collision DLL
-------------------------------------------------------------------
remend
rem ********************************
rem INITIALIZING
rem ********************************
rem The First Thing We Need to Do is to Turn On Manual Syncing
Sync On : Sync Rate 60
rem Next Step is to include the Functions for DBCcollision.dll
#include "functions.dba"
rem ********************************
rem ********************************
rem ********************************
rem THE WORLD
rem ********************************
rem Load The Level we will use in this tutorial
WORLD = 1 : Load Object "map.x", WORLD
rem Now Setup This Objects Collision
setupObjectDBC( WORLD, 1, 0 )
` setupObjectDBC(objNum,groupNum,objectType)
` ..objNum = Object To Setup
` ..groupNum = which group object belongs to
` ..objectType = i dont remember what this is for.. :
setObjectCollisionOnDBC(1)
` setObjectCollisionOnDBC(objNum)
` ..objNum = object to affect
rem ********************************
rem ********************************
rem ********************************
rem THE PLAYER
rem ********************************
PLAYER = 2 : playerspeed = 10
camx# = 0.0 : camy# = 5.0 : camz# = 0.0
make object box player, 6, 80, 6
set object collision on player
position object player, camx#, camy#, camz#
hide object player
make object collision box player,-16,-40,-16,16,40,16,0
rem ********************************
rem ********************************
rem ********************************
rem CREATION OF BULLETHOLES
rem ********************************
bullet_holes = 99
bullet_holes_start_on_object = 100
load image "hole.bmp",2
for x = 1 to bullet_holes
make object plain x+bullet_holes_start_on_object,4,4
texture object x+bullet_holes_start_on_object,2
ghost object on x+bullet_holes_start_on_object
hide object x+bullet_holes_start_on_object
fade object x+bullet_holes_start_on_object,-100
next x
rem ********************************
rem ********************************
rem Start Game Loop
REPEAT
Gosub PLAYER
SYNC
UNTIL ESCAPEKEY() > 0
PLAYER:
Gosub MOVEMENT
Gosub WEAPON
RETURN
MOVEMENT:
rem Store Old Player Position
oldx# = camera position x() : oldy# = camera position y() : oldz# = camera position z()
rem Move Using Arrows
if upkey() then x#=newxvalue(x#, camay#, playerspeed) :z#=newzvalue(z#, camay#, playerspeed) :humanwalk= wrapvalue( humanwalk + playerspeed*4 )
if downkey() then x#=newxvalue(x#, camay#, playerspeed*-1):z#=newzvalue(z#, camay#, playerspeed*-1):humanwalk= wrapvalue( humanwalk + playerspeed*4 )
if rightkey() then x#=newxvalue(x#, camay#+90, playerspeed):z#=newzvalue(z#, camay#+90, playerspeed):humanwalk= wrapvalue( humanwalk + playerspeed*4 )
if leftkey() then x#=newxvalue(x#, camay#-90, playerspeed):z#=newzvalue(z#, camay#-90, playerspeed):humanwalk= wrapvalue( humanwalk + playerspeed*4 )
rem Rotate Using Mouse
camay# = wrapvalue( camay# + mousemovex() /3 )
camax# = wrapvalue( camax# + mousemovey() /3 )
rotate camera camax#, camay#, 0
rem Check for Collision
collide = intersectObjectDBC(1,0,oldx#,oldy#,oldz#,x#,y#,z#,65535)
` intersectObjectDBC(objNum,groupFlag,oldx#,oldy#,oldz#,x#,y#,z#,excludeObj)
` ..objNum = Check for Collision on this object
` ..groupFlag = Check for Collision on objects in this group
` ..oldx#, oldy#, oldz# = from this location
` ..x#, y#, z# = to this location
` ..excludeObj = Dont check for collision on this object
rem WALL COLLISION
if collide>0
newx# = getStaticCollisionX() : normx# = getCollisionNormalX()
newz# = getStaticCollisionZ() : normz# = getCollisionNormalZ()
x# = newx# + normx#
z# = newz# + normz#
position camera x#, y#+40, z#
position object player, x#, y#, z#
endif
rem HUMAN WALK
humancalc=cos(humanwalk)*4
if humanwalk>190 and humanwalk<211 and jump=0 and ground=1
player_footsound=25+rnd(5)
play sound player_footsound
player_footsound_timer=0
humanwalk=humanwalk+10
endif
position camera x#,y#+humancalc+40,z#
position object player,x#,y#+40,z#
position listener x#,y#+humancalc+40,z#
rotate camera camax#,camay#,0
rotate listener camax#,camay#,0
RETURN
WEAPON:
If MouseClick() = 1 And Latch = 0
Latch = 1
GOSUB BULLET
EndIf
If MouseClick() = 0 Then Latch = 0
RETURN
BULLET:
rem ********************************
rem BULLETHOLES
rem ********************************
rem First Store the current position from where we are firing from
oldx22# = camera position x()
oldy22# = camera position y()
oldz22# = camera position z()
rem We use the camera and camera angle to determie where we hit *first person shooter*
move camera 3000
rem Get New Position (the position where the bullet hits
x22# = camera position x()
y22# = camera position y()
z22# = camera position z()
rem Restore Camera
move camera -3000
rem Check for Collision
collide2 = intersectObjectDBC( 1, 0, oldx22#, oldy22#, oldz22#, x22#, y22#, z22#, 0 )
` intersectObjectDBC(objNum,groupFlag,oldx#,oldy#,oldz#,x#,y#,z#,excludeObj)
` ..objNum = Check for Collision on this object
` ..groupFlag = Check for Collision on objects in this group
` ..oldx#, oldy#, oldz# = from this location
` ..x#, y#, z# = to this location
` ..excludeObj = Dont check for collision on this object
rem Did we get a collision??
if collide2 <> 0
rem Yes.
rem Get The Position of the collision
newx# = getStaticCollisionX()
newy# = getStaticCollisionY()
newz# = getStaticCollisionZ()
rem Get The Angle of the collision
normx# = getCollisionNormalX()
normy# = getCollisionNormalY()
normz# = getCollisionNormalZ()
rem !CREATE A BULLETHOLE!
if bullet_holes >0
` is the counter below the first bullethole?
if bullethole_counter < (bullet_holes_start_on_object+1) then bullethole_counter = 101
bh = bullethole_counter
` position the bullethole
position object bh, newx#+normx#/10.0, newy#+normy#/10.0, newz#+normz#/10.0
` rotate the bullethole
point object bh, newx#+normx#, newy#+normy#, newz#+normz#
` give the bullethole a spin
zrotate object bh, rnd(359)
` and show it
show object bh
` inc the counter
bullethole_counter = bullethole_counter + 1
` if maximum bulletholes reached then START OVER ON THE FIRST BULLETHOLE
if bullethole_counter > (bullet_holes_start_on_object + bullet_holes) then bullethole_counter = 0
endif
rem PLAY SOUND
` impact = 74+rnd(3)
` position sound impact, newx#+normx#/10.0, newy#+normy#/10.0, newz#+normz#/10.0 : play sound impact
endif
RETURN
here.
and you can download the media if you want (source included) on the red download button
if you still need more help then post again