|
Blocky
Dec 5, 2008 18:48:11 GMT -5
Post by Adam on Dec 5, 2008 18:48:11 GMT -5
I saw a pretty cool game on the freebasic forum (Sokoban 3D) and decided to make my own version of it.. well it started as that then i just kept getting more and more ideas until i got This. So tell me what you think.. so far i only have the one level for it and would much appreciate it if you would be so kind as to make more ;D(the format specifications are commented in the level).. with the instructions that show when you run it.. press the space bar or enter key to skip... Darkjester has already played it and loves it
|
|
|
Blocky
Dec 5, 2008 22:17:47 GMT -5
Post by cthug on Dec 5, 2008 22:17:47 GMT -5
Very good, i like it, only complaintsthe moving box is a but lame and when two boxes are next to each other it glitches when you try to push them apart. Other than that nice game, good work
|
|
|
Blocky
Dec 6, 2008 19:32:31 GMT -5
Post by Adam on Dec 6, 2008 19:32:31 GMT -5
here i added several other nice things like a level editor with a complete gui.. hopefully people will start making levels..(please) and if you find any bugs or glitches let me know and i wll try to fix them.. Here ya goabout the moving box.. darkjester is making me a model for it but it still won't be too great because i think the player still needs to represent the name "blocky".. the box glitch i am working on as we speak and should have it fixed b4 too long..
|
|
|
Blocky
Dec 6, 2008 20:20:02 GMT -5
Post by Adam on Dec 6, 2008 20:20:02 GMT -5
grr.. dumb bugs.. here.. replace level select.dat with this
Temp$ = FindFirstFile("Levels/*.dat") Dim Temp, Current, Past while Temp$ <> "" Temp$ = FindNextFile() Temp = Temp + 1 wend FindClose() Dim FileName$(Temp-1) Dim FileTex(Temp-1) I = 0 FileName$(I) = FindFirstFile("Levels/*.dat") FileName$(I) =Left$(FileName$(I),Len(FileName$(I))-4) FileTex(I) = LoadTex("Levels\"+FileName$(I)+".png") I = 1 Do FileName$(I) = FindNextFile() Filename$(I) = Left$(FileName$(I),Len(FileName$(I))-4) FileTex(I) = LoadTex("Levels\"+FileName$(I)+".png") I = I + 1 Loop Until I > Temp-1 FindClose() NewSprite(FileTex(0)):SprSetPos(320,240):SprSetSize(640,480): SprSetZOrder(11) Do DrawText() SwapBuffers() cls glClear(GL_DEPTH_BUFFER_BIT or GL_COLOR_BUFFER_BIT) glLoadIdentity() Locate 2,2: Print FileName$(Current) IF Current <> Past Then SprSetTexture(FileTex(Current)) Past = Current Endif While SyncTimer (100) IF ScanKeyDown(VK_Down) OR ScanKeyDown(VK_Right) Then Current = Current + 1 Endif IF ScanKeyDown(VK_Up) OR ScanKeyDown(VK_Left) Then Current = Current - 1 Endif IF ScanKeyDown(VK_Return) OR ScanKeyDown(VK_Space) Then Clear():Load_Level(FileName$(Current)): Goto GameLoop Endif IF Current < 0 Then Current = Temp-1 Endif IF Current > Temp-1 Then Current = 0 Endif Wend Loop
|
|
|
Blocky
Dec 7, 2008 4:17:31 GMT -5
Post by matthew on Dec 7, 2008 4:17:31 GMT -5
Very nice game, I'd never seen it in the FreeBASIC forum before you mentioned it.
|
|
|
Blocky
Dec 8, 2008 21:43:13 GMT -5
Post by Adam on Dec 8, 2008 21:43:13 GMT -5
basic4gl.wikispaces.com/file/detail/Blocky.zipok.. heres the latest version.. hope you like.. i added some special blocks to spice things up a bit to see check lvl1 in the level select. and if you havn't noticed... there are some new levels.. if you have any problems or ideas please share.. i would like to better the game further. ps. if you think the level editor is confusing or hard to use.. tell me and i will make a tut for it if i have the time
|
|
|
Blocky
Jan 16, 2009 2:50:51 GMT -5
Post by Adam on Jan 16, 2009 2:50:51 GMT -5
for anyone that feels like faking physics as i did, i am gonna give out the source lol.
#plugin toolbox.dll Include Modded buttonlib_v12.inc 'The player structure. struc SPlayer dim Pos#(2) dim Vel#(2) Dim OldVel#(2) dim Ang#(2) dim Height# dim DampMovement# dim OnGround Dim Spin# endstruc
Struc SBox Dim Pos#(2) Dim Vel#(2) Dim OldVel#(2) Dim Hitxz, Hitx Dim Hitz, Hity Dim FreeFall Dim OnGround Dim Tex Dim On End Struc
Struc SCamera Dim Angle#(1) Dim Zoom# End Struc
dim SPlayer Player dim HeadOn, FreeFall, Hitxz, Hitx, Hitz, Hity dim Range(5) dim Object#(2) Dim Level = glGenLists(1) , Cube = glGenLists(1)
Dim Width, Height, Depth Dim X, Y, Z, I Dim BUT_STRUC Buttons(20) Dim &Map()()() Dim SCamera Cam Dim Special#(1)(3) Dim lvl Dim Timer Dim Ends
Dim Temp$ Dim Zoom#
Alloc Map, 100, 100, 100 Dim Texture(100), TexName$(100) Dim Crate(100), TexFile$ Dim TexActive, MaxHeight, MaxWidth,MaxDepth Dim BoundTex, Clamp Dim TexCount(3), FileMethod Dim FileActive Dim old,Old2#(2), ScreenShot Dim Temp, Current, Past Dim FileName$(100) Dim FileTex(100), play Dim Special = LoadTex("Textures/001.jpg")
Const Gravity# = .00075
Dim GoalTex(1) GoalTex(0) = LoadTex("Textures/bluesilk.png") GoalTex(1) = LoadTex("Textures/redsilk.png")
'Box Variables Dim SBox &Box() Dim BoxCount Dim ActiveBox Dim BoxMax Dim BoxTex(5) Dim SBox &Default Dim BoxInPos Dim BoxGoal
For I = 0 To 5 BoxTex(I) = LoadTex("Textures\Crate"+I+".png") Next
Declare Sub Clear() Declare Sub Load_Level(FileName$) Declare Sub bMoveDefaultes(Sbox &Defult)
glNewList(Cube, GL_COMPILE) glBegin (GL_QUADS) ' Front glTexCoord2f(0.0, 0.0): glVertex3f(-0.5, -0.5, 0.5) glTexCoord2f(1.0, 0.0): glVertex3f( 0.5, -0.5, 0.5) glTexCoord2f(1.0, 1.0): glVertex3f( 0.5, 0.5, 0.5) glTexCoord2f(0.0, 1.0): glVertex3f(-0.5, 0.5, 0.5) ' Back glTexCoord2f(1.0, 0.0): glVertex3f(-0.5, -0.5, -0.5) glTexCoord2f(1.0, 1.0): glVertex3f(-0.5, 0.5, -0.5) glTexCoord2f(0.0, 1.0): glVertex3f( 0.5, 0.5, -0.5) glTexCoord2f(0.0, 0.0): glVertex3f( 0.5, -0.5, -0.5) ' Top glTexCoord2f(0.0, 1.0): glVertex3f(-0.5, 0.5, -0.5) glTexCoord2f(0.0, 0.0): glVertex3f(-0.5, 0.5, 0.5) glTexCoord2f(1.0, 0.0): glVertex3f( 0.5, 0.5, 0.5) glTexCoord2f(1.0, 1.0): glVertex3f( 0.5, 0.5, -0.5) ' Bottom glTexCoord2f(1.0, 1.0): glVertex3f(-0.5, -0.5, -0.5) glTexCoord2f(0.0, 1.0): glVertex3f( 0.5, -0.5, -0.5) glTexCoord2f(0.0, 0.0): glVertex3f( 0.5, -0.5, 0.5) glTexCoord2f(1.0, 0.0): glVertex3f(-0.5, -0.5, 0.5) ' Left glTexCoord2f(0.0, 0.0): glVertex3f(-0.5, -0.5, -0.5) glTexCoord2f(1.0, 0.0): glVertex3f(-0.5, -0.5, 0.5) glTexCoord2f(1.0, 1.0): glVertex3f(-0.5, 0.5, 0.5) glTexCoord2f(0.0, 1.0): glVertex3f(-0.5, 0.5, -0.5) ' Right glTexCoord2f(1.0, 0.0): glVertex3f( 0.5, -0.5, -0.5) glTexCoord2f(1.0, 1.0): glVertex3f( 0.5, 0.5, -0.5) glTexCoord2f(0.0, 1.0): glVertex3f( 0.5, 0.5, 0.5) glTexCoord2f(0.0, 0.0): glVertex3f( 0.5, -0.5, 0.5) glEnd () glEndList()
glEnable(GL_TEXTURE_2D) glEnable(GL_CULL_FACE) TextMode(Text_OverLaid) SetTextScroll(False) ResizeText(60,40) Color(0,0,0)
' Set up the fog glClearColor(.8, .8, .8, 1) glFogi(GL_FOG_MODE, GL_EXP2) glFogfv(GL_FOG_COLOR, vec4(1, 1, 1, 0)) glFogf(GL_FOG_DENSITY, 0.01) glHint(GL_FOG_HINT, GL_FASTEST) glEnable(GL_FOG) ShowCursor(True) UpdateSprSet() CompFile("menu.dat"): Exec
Sub Parse(X, Y, Z) IF Map(X)(Y)(Z) = -10 Then Player.Pos# = Vec3(X, Y, Z) Map(X)(Y)(Z) = -1 ElseIF Map(X)(Y)(Z) > -8 Then Box(BoxCount).Pos# = Vec3(X,Y,Z) Box(BoxCount).OnGround=true Box(BoxCount).Tex = Abs(Map(X)(Y)(Z)) - 2 BoxCount = BoxCount + 1 Endif End Sub
Sub Clear() ClearSprites() For I = 0 To 3 Buttons(I).Handle = 0 Next End Sub
Sub Load_Level(FileName$) Dim File$, TexCount Timer = 0 Player.Height#=0 BoxCount = 0 BoxInPos = 0 Player.Ang# = vec3(0,0,0) Player.DampMovement#=50 Player.OnGround=true CompFile("Levels\"+FileName$+".dat") IF CompilerError() <> "" Then Ends = True: Return Endif: Exec Read BoxGoal Read BoxMax Read TexCount Dim Texture(TexCount - 1) For I = 0 To TexCount - 1 Read File$ Texture(I) = LoadTex("Textures\"+File$) Next Read Width, Height, Depth Alloc Box, BoxMax-1 Alloc Map, Width, Height, Depth glNewList(Level, GL_COMPILE) For Y = 0 To Height - 1 For Z = 0 To Depth - 1 For X = 0 To Width - 1 Read Map(X)(Y)(Z) IF Map(X)(Y)(Z) = -1 Then ElseIF Map(X)(Y)(Z) < -1 Then Parse(X,Y,Z) ElseIF Map(X)(Y)(Z) > -1 And Map(X)(Y)(Z) < 10 Then glPushMatrix() glTranslatef(x,y,z) glBindTexture (GL_TEXTURE_2D, Texture(Map(x)(y)(z))) glCallList(Cube) glPopMatrix() Elseif Map(X)(Y)(Z) < 12 Then glPushMatrix() glTranslatef(x,y,z) glBindTexture (GL_TEXTURE_2D, GoalTex(Map(x)(y)(z)-10)) glCallList(Cube) glPopMatrix() ElseIF Map(X)(Y)(Z) = 13 Then glPushMatrix() glTranslatef(x,y,z) glBindTexture (GL_TEXTURE_2D, Special) glCallList(Cube) glPopMatrix() Endif Next Next Next glEndList() End Sub
Load_Level("lvl0") GameLoop: do DrawText() SwapBuffers() cls glClear(GL_DEPTH_BUFFER_BIT or GL_COLOR_BUFFER_BIT) glLoadIdentity() GLTranslateF(0,0,-75+Cam.Zoom#) GLRotateF(20,1,0,0) GLRotateF(Cam.Angle#(0),1,0,0) GLRotateF(Cam.Angle#(1),0,1,0) GLTranslateF(-(Player.Pos#(0)*10),-10-(Player.Pos#(1)*10),-(Player.Pos#(2)*10)) glScalef(10,10,10) 'glRotatef(Player.Ang#(2), 0, 0, 1) 'glRotatef(Player.Ang#(0), 1, 0, 0) 'glRotatef(Player.Ang#(1), 0, 1, 0) 'glTranslatef(-Player.Pos#(0), -Player.Pos#(1)-Player.Height#, -Player.Pos#(2)) glCallList(Level) For I = 0 To BoxCount - 1 glPushMatrix() glTranslatef(Box(I).Pos#(0),Box(I).Pos#(1),Box(I).Pos#(2)) glBindTexture (GL_TEXTURE_2D, BoxTex(Box(I).Tex)) glCallList(Cube) glPopMatrix() Next GLTranslateF(Player.Pos#(0), Player.Pos#(1)-Player.Height#, Player.Pos#(2)) IF BoxInPos = BoxGoal Then Player.Spin# = Player.Spin# + 10: Player.Pos#(1) = Player.Pos#(1) + .5: Player.Vel#(1) = 0: GLRotateF(Player.Spin#,0,1,0) Endif glBindTexture (GL_TEXTURE_2D, BoxTex(0)) GLCallList(Cube)
IF Ends Then Locate TextCols()/2-7,TextRows()/2 Print "Congratulations" Timer = Timer + 1 IF Timer = 180 Then CompFile("menu.dat"): Exec Endif ElseIF BoxInPos = BoxGoal Then Locate TextCols()/2-5,TextRows()/2 Print "Level Clear" Timer = Timer + 1 IF Timer = 80 Then lvl = lvl + 1 IF Play Then Load_Level("lvl"+Lvl) Endif CompFile("menu.dat"): Exec Endif Else Printr "Boxes/Boxes Needed:" Print " "+BoxInPos+"/"BoxGoal Endif
while synctimer(7) if not(Player.OnGround) then Player.vel#(1) = Player.vel#(1) - Gravity# endif
' Check Collision Gosub MainCollision
if not hitxz then ' elseif not(hitz) and not(hity) and FreeFall and hitx then IF ActiveBox > -1 Then Box(ActiveBox).Vel#(0) = Player.Vel#(0) endif Player.vel#(0) = 0 elseif not(hitx) and not(hity) and FreeFall and hitz then IF ActiveBox > -1 Then Box(ActiveBox).Vel#(2) = Player.Vel#(2) endif Player.vel#(2) = 0 else Player.vel#(0) = 0 Player.vel#(2) = 0 endif
Player.Pos#(0)=Player.Pos#(0)+Player.Vel#(0) Player.Pos#(2)=Player.Pos#(2)+Player.Vel#(2) Player.Vel#(0)=0 Player.Vel#(2)=0
Gosub YCollision
if hity then Player.OnGround=true Player.vel#(1)=0 endif
if Player.OnGround and not(FreeFall) then Player.vel#(1)=0 Player.OnGround=false endif
if HeadOn=true then Player.vel#(1)=0 endif
Player.Pos#(1)=Player.Pos#(1)+Player.Vel#(1)
' Update Boxes BoxInPos = 0 For I = 0 To BoxCount - 1 bMoveDefaultes(Box(I)) IF Box(I).On Then BoxInPos = BoxInPos + 1 Endif Next &Default = null ' Get input (keypresses/mouse) Gosub PlayerInput wend
loop
PlayerInput: 'Player.Ang#(0)=Player.Ang#(0)+Mouse_YD()*20.0 Player.Ang#(1)=Cam.Angle#(1) if keydown("W") then Player.Vel#(0)=Player.Vel#(0)+Cosd(Player.Ang#(1)-90)/Player.DampMovement# Player.Vel#(2)=Player.Vel#(2)+Sind(Player.Ang#(1)-90)/Player.DampMovement# endif if keydown("S") then Player.Vel#(0)=Player.Vel#(0)-Cosd(Player.Ang#(1)-90)/Player.DampMovement# Player.Vel#(2)=Player.Vel#(2)-Sind(Player.Ang#(1)-90)/Player.DampMovement# endif if keydown("D") then Player.Vel#(0)=Player.Vel#(0)+Cosd(Player.Ang#(1))/Player.DampMovement# Player.Vel#(2)=Player.Vel#(2)+ Sind(Player.Ang#(1))/Player.DampMovement# endif if keydown("A") then Player.Vel#(0)=Player.Vel#(0)-Cosd(Player.Ang#(1))/Player.DampMovement# Player.Vel#(2)=Player.Vel#(2)-Sind(Player.Ang#(1))/Player.DampMovement# endif if scankeydown(VK_SPACE) and Player.OnGround then Player.OnGround=false Player.Vel#(1)=.05 endif IF ScanKeyDown(VK_Up) Then Cam.Angle#(0) = Cam.Angle#(0) + .25 Endif IF ScanKeyDown(VK_Down) Then Cam.Angle#(0) = Cam.Angle#(0) - .25 Endif
IF ScanKeyDown(VK_Add) Then Cam.Zoom# = Cam.Zoom# + .25 Endif IF ScanKeyDown(VK_Subtract)Then Cam.Zoom# = Cam.Zoom# - .25 Endif
IF Cam.Zoom# >= 77.25 Then Cam.Zoom# = 77.25 IF ScanKeyDown(VK_Left) Then Cam.Angle#(1) = Cam.Angle#(1) - .25 Endif IF ScanKeyDown(VK_Right)Then Cam.Angle#(1) = Cam.Angle#(1) + .25 Endif Else IF ScanKeyDown(VK_Left) Then Cam.Angle#(1) = Cam.Angle#(1) + .25 Endif IF ScanKeyDown(VK_Right)Then Cam.Angle#(1) = Cam.Angle#(1) - .25 Endif Endif
if Player.Ang#(0)>90 then Player.Ang#(0)=90 endif if Player.Ang#(0)<-90 then Player.Ang#(0)=-90 endif return
Function CheckWall() Range(0)=int(object#(0)-1) Range(1)=int(object#(1)-1) Range(2)=int(object#(2)-1) Range(3)=int(object#(0)+1) Range(4)=int(object#(1)+1) Range(5)=int(object#(2)+1)
if Range(0)<0 then Range(0)=0 endif if Range(1)<0 then Range(1)=0 endif if Range(2)<0 then Range(2)=0 endif
if Range(3)>Width-1 then Range(3)=Width-1 endif if Range(4)>Height-1 then Range(4)=Height-1 endif if Range(5)>Depth-1 then Range(5)=Depth-1 endif
for x = Range(0) to Range(3) for y = Range(1) to Range(4) for z = Range(2) to Range(5) if Map(x)(y)(z)>-1 And (Map(X)(Y)(Z) <> 12 or &Default = null) then if object#(0)>(x-.99) and object#(0)<(x+.99) then if object#(1)>(y-.99) and object#(1)<(y+.99) then if object#(2)>(z-.99) and object#(2)<(z+.99) then IF &Default <> null Then IF Default.Tex + 8 = Map(x)(y)(z) Then IF (Default.Tex > 1 And Default.Tex < 4) Then Default.On = True Endif: Endif: Endif Return True endif: endif: endif: endif next: next: next Return False End Function
Function CheckWall1(A,B) Range(0)=int(object#(0)-1) Range(1)=int(object#(1)-1) Range(2)=int(object#(2)-1) Range(3)=int(object#(0)+1) Range(4)=int(object#(1)+1) Range(5)=int(object#(2)+1)
if Range(0)<0 then Range(0)=0 endif if Range(1)<0 then Range(1)=0 endif if Range(2)<0 then Range(2)=0 endif
if Range(3)>Width-1 then Range(3)=Width-1 endif if Range(4)>Height-1 then Range(4)=Height-1 endif if Range(5)>Depth-1 then Range(5)=Depth-1 endif
for x = Range(0) to Range(3) for y = Range(1) to Range(4) for z = Range(2) to Range(5) if Map(x)(y)(z)= A or Map(X)(Y)(Z) = B then if object#(0)>(x-.1) and object#(0)<(x+.1) then if object#(1)>(y-1.1) and object#(1)<(y+1.1) then if object#(2)>(z-.1) and object#(2)<(z+.1) then IF &Default <> null Then IF Default.Tex + 8 = Map(x)(y)(z) Then IF (Default.Tex > 1 And Default.Tex < 4) Then Default.On = True Endif: Endif: Endif Return True endif: endif: endif: endif next: next: next Return False End Function
Function CheckBox() For I = 0 To BoxCount - 1 if object#(0)>(Box(I).Pos#(0)-.99) and object#(0)<(Box(I).Pos#(0)+.99) then if object#(1)>(Box(I).Pos#(1)-.99) and object#(1)<(Box(I).Pos#(1)+.99) then if object#(2)>(Box(I).Pos#(2)-.99) and object#(2)<(Box(I).Pos#(2)+.99) then ActiveBox = I Return True endif: endif: endif Next Return False End Function
Function CheckBoxOnBox(Current) Dim I For I = 0 To BoxCount - 1 IF I <> Current Then if object#(0)>(Box(I).Pos#(0)-.99) and object#(0)<(Box(I).Pos#(0)+.99) then if object#(1)>(Box(I).Pos#(1)-.99) and object#(1)<(Box(I).Pos#(1)+.99) then if object#(2)>(Box(I).Pos#(2)-.99) and object#(2)<(Box(I).Pos#(2)+.99) then Default.Vel# = Box(I).OldVel# Return True endif: endif: endif: Endif Next if object#(0)>(Player.Pos#(0)-.99) and object#(0)<(Player.Pos#(0)+.99) then if object#(1)>(Player.Pos#(1)-.99) and object#(1)<(Player.Pos#(1)+.99) then if object#(2)>(Player.Pos#(2)-.99) and object#(2)<(Player.Pos#(2)+.99) then Return True endif: endif: endif Return False End Function
MainCollision: ActiveBox = -1 ' Check XZ Collision object#(0) = Player.Pos#(0)+Player.Vel#(0) object#(1) = Player.Pos#(1) object#(2) = Player.Pos#(2)+Player.Vel#(2) IF CheckWall() Or CheckBox() Then Hitxz = True Else Hitxz = False Endif
if Hitxz then ' Check X Collision object#(0) = Player.Pos#(0)+Player.vel#(0) object#(1) = Player.Pos#(1) object#(2) = Player.Pos#(2) IF CheckWall() Or CheckBox() Then Hitx = True Else Hitx = False Endif ' Check Z Collision object#(0) = Player.Pos#(0) object#(1) = Player.Pos#(1) object#(2) = Player.Pos#(2)+Player.Vel#(2) IF CheckWall() Or CheckBox() Then Hitz = True Else Hitz = False Endif endif
return
YCollision: ' Check Y Collision object#(0) = Player.Pos#(0) object#(1) = Player.Pos#(1)+Player.vel#(1) object#(2) = Player.Pos#(2) IF CheckWall() Or CheckBox() Then Hity = True Else Hity = False Endif
' Check FreeFall Collision object#(0) = Player.Pos#(0) object#(1) = Player.Pos#(1)-Gravity# object#(2) = Player.Pos#(2) IF CheckWall() Or CheckBox() Then FreeFall = True Else FreeFall = False Endif IF CheckWall1(13,13) Then Player.OnGround=false Player.Vel#(1)=.15 Endif ' Check Head on Collision if Player.vel#(1)>0 then object#(0) = Player.Pos#(0) object#(1) = Player.Pos#(1)+Player.Height#+Player.vel#(1) object#(2) = Player.Pos#(2) HeadOn = CheckWall() else HeadOn=false endif
Return
Sub bMoveDefaultes(SBox &Defult) &Default = &Defult Default.On = False if not(Default.OnGround) then Default.vel#(1) = Default.vel#(1) - Gravity# endif ' Check XZ Collision object#(0) = Default.Pos#(0)+Default.Vel#(0) object#(1) = Default.Pos#(1) object#(2) = Default.Pos#(2)+Default.Vel#(2) IF CheckWall() Or CheckBoxOnBox(I) Then Default.hitxz = True Else Default.hitxz = False Endif
if Hitxz then ' Check X Collision object#(0) = Default.Pos#(0)+Default.vel#(0) object#(1) = Default.Pos#(1) object#(2) = Default.Pos#(2) IF CheckWall() Or CheckBoxOnBox(I) Then Default.hitx = True Else Default.hitx = False Endif ' Check Z Collision object#(0) = Default.Pos#(0) object#(1) = Default.Pos#(1) object#(2) = Default.Pos#(2)+Default.Vel#(2) IF CheckWall() Or CheckBoxOnBox(I) Then Default.hitz = True Else Default.hitz = False Endif Endif
if not Default.hitxz then elseif not(Default.hitz) and not(Default.hity) and Default.FreeFall and Default.hitx then Default.vel#(0) = 0 elseif not(Default.hitx) and not(Default.hity) and Default.FreeFall and Default.hitz then Default.vel#(2) = 0 else Default.vel#(0) = 0 Default.vel#(2) = 0 endif Default.Pos#(0)=Default.Pos#(0)+Default.Vel#(0) Default.Pos#(2)=Default.Pos#(2)+Default.Vel#(2) Default.OldVel#(0) = Default.Vel#(0) Default.OldVel#(2) = Default.Vel#(2) Default.Vel#(0)=0 Default.Vel#(2)=0 ' Check Y Collision object#(0) = Default.Pos#(0) object#(1) = Default.Pos#(1)+Default.vel#(1) object#(2) = Default.Pos#(2) IF CheckWall() Or CheckBoxOnBox(I) Then Default.hity = True Else Default.hity = False Endif CheckWall1(10,11) ' Check FreeFall Collision object#(0) = Default.Pos#(0) object#(1) = Default.Pos#(1)-Gravity# object#(2) = Default.Pos#(2) IF CheckWall() Or CheckBoxOnBox(I) Then Default.FreeFall = True Else Default.FreeFall = False Endif if Default.hity then Default.OnGround=true Default.vel#(1)=0 endif if Default.OnGround and not(Default.FreeFall) then Default.vel#(1)=0 Default.OnGround=false endif
' Update Default position Default.Pos#(1)=Default.Pos#(1)+Default.Vel#(1) Default.OldVel#(1) = Default.Vel#(1) End Sub
|
|