n00b sprite related issues

Advanced game related topics
wolfwood2x
User
User
Posts: 76
Joined: Sun Oct 02, 2005 5:08 am

Post by wolfwood2x »

Well I have decided if I can successfully code this game I will more than likely buy it. I just didnt want to purchase yet another compiler I will barely use. I have a bad habit of starting 100 hobbies getting all the stuff i need for them and then never touching them again ^_^

I have VB6.0 and
VB .Net Several books for each
and nothing more than some simple api call tests to show for it.
Several books on PHP, CGI and DHTML as well.
So i didnt want to buy the compiler and the book and be out $$ and then look like an idiot yet again .

But As I said IF i can code this or learn enough to warrant this I will most defenitely purchase it.
Beach
Enthusiast
Enthusiast
Posts: 677
Joined: Mon Feb 02, 2004 3:16 am
Location: Beyond the sun...

Post by Beach »

You know I have been singing PureBasic's praises to you for about a year now! - I will not allow you to let it go to waste! :) Its been the best software investment I have ever made. Heck, I'm even planing on buying it again when 4.0 is released.

I work with WolfWood (but I am not the focus of this game thank god!).
-Beach
MadMax
Enthusiast
Enthusiast
Posts: 237
Joined: Mon Oct 06, 2003 11:56 am

Post by MadMax »

OK my example is ready, here is the code

Code: Select all

If InitSprite()=0 Or InitMouse()=0 Or InitKeyboard()=0
MessageRequester("Error","Can't start DX",#PB_MessageRequester_Ok)
End 
EndIf

OpenScreen(640,480,32,"Dabidu")

Background=LoadSprite(#PB_Any,"Background.bmp",0)
Hbg=LoadSprite(#PB_Any,"HardBG.bmp",0)
cursor=LoadSprite(#PB_Any,"cursor.bmp",0)

hit$=""
hardon=0

Repeat



StopDrawing()

If hardon
DisplaySprite(hbg,0,0)
Else
DisplaySprite(background,0,0)
EndIf

DisplayTransparentSprite(cursor,mx,my)

StartDrawing(ScreenOutput())
DrawingMode(1)
FrontColor(255,255,0)
For sy=20 To 480 Step 40
For sx=20 To 600 Step 100
Locate(sx,sy)
DrawText(hit$)
Next
Next

FlipBuffers(1)

If SpritePixelCollision(cursor,mx,my,hbg,0,0)
hit$="COLLISION!!!"
Else
hit$=""
EndIf

ExamineMouse()

mx=MouseX()
my=MouseY()

ExamineKeyboard()

If KeyboardReleased(#PB_Key_Space)
Select hardon
  Case 0
  hardon=1
  
  Case 1
  hardon=0
  
EndSelect
EndIf


Until KeyboardPushed(#PB_Key_Escape)
End
And http://www.raver.moonfilth.com/collision.zip this is a zip with code and graphics

move the mouse to check collisions, and space to toggle between background or hardness map.


hopè this helps.
Post Reply