Blitzmax 2d Collide Basic

posted on 30 Apr 2009 02:27 by inoobna

Blitzmax มีฟังค์ชั่นหนึ่งนะครับที่ใช้เชคการชนของพี่ได้ดีเลยคือ

imagesCollide:Int(image1,x1,y1,frame1,image2,x2,y2,frame2)
โดยจะคือค่าเป็น ข้อมูลชนิด Boolean



Code :

Apptitle="Basic Collision"
Graphics 800, 600


Local Ball:IBall = IBall.Create(50, 50)
Local Box:IBox = IBox.Create(150, 150)




Repeat
Cls
If ImagesCollide(Ball.entity, Ball.x, Ball.y, 0, Box.entity, Box.x, Box.y, 0)
DrawText("Collision !!", 0, 0)
End If
Ball.Update()
Box.Draw()
Flip
Until
AppTerminate() Or KeyDown(KEY_ESCAPE) ;End



Type
IObj
Field x:Float, y:Float
Field speed:Float, entity:TImage
Field width:Float, height:Float
End
Type


Type
IBox Extends IObj
Function Create:IBox(posX:Float, posY:Float)
Local Box:IBox = New IBox
Box.x
= posX;Box.y = posY
Box.width
= 30;Box.height = 30
Box.entity = CreateImage(Box.width, Box.height)
SetColor(0, 0, 255)
DrawRect(Box.x, Box.y, Box.width, Box.height)
SetColor(255, 255, 255)
GrabImage(Box.entity, Box.x, Box.y)
Return Box
End Function
Method Draw()
DrawImage Self.entity, Self.x, Self.y
End Method
End
Type


Type
IBall Extends IObj
Function Create:IBall(posX:Float, posY:Float)
Local ball:IBall = New IBall
ball.width
= 30;ball.height = 30
ball.x = posX;ball.y = posY
ball.speed
= 1
ball.entity = CreateImage(ball.width, ball.height)
SetColor(255, 150, 50)
DrawOval x, y, 30, 30
SetColor(255, 255, 255)
GrabImage(ball.entity, x, y)
Return ball
End Function

Method Update()
If KeyDown(KEY_W)
Self.y:-Self.speed
End If
If KeyDown(KEY_S)
Self.y:+Self.speed
End If
If KeyDown(KEY_A)
Self.x:-Self.speed
End If
If KeyDown(KEY_D)
Self.x:+Self.speed
End If
DrawImage(Self.entity, Self.x, Self.y)
End Method

End Type

Irrlicht + Blitzmax ตอน 1

posted on 24 Apr 2009 17:05 by inoobna
วันนี้ได้มีโอกาศโหลด Irrlicht ของ gman มาเล่นดู
ซึ่ง เจ้า Irrlicht ตัวนี้ สามารถพัฒณาด้วย Blitzmax (พระเอกของเรา) ได้ด้วย!!
มาดู  กันเลยดีกว่า

SuperStrict
framework Irrlicht.core

Local Device:IrrlichtDevice = IrrlichtDevice.Create(EDT_DIRECT3D9, _DIMENSION2DI(800, 600), 32, 0)
Device.setWindowCaption(
"Hello World")

local Driver:IVideoDriver = Device.getVideoDriver()
Local smgr:ISceneManager = Device.getSceneManager()
local guienv:IGUIEnvironment = Device.getGuienvironment()

guienv.addStaticText(
"Hello World !!",_RECTI(0,0,300,15))

Repeat
Driver.beginScene(True, True, _SCOLOR(255, 150, 150, 255))
smgr.drawAll()
Guienv.drawAll()
Driver.endScene()
Until not Device.run(); Device.Drop()


Blide for Blitzmax !!

posted on 22 Apr 2009 14:35 by inoobna

ว๊ากกกก วันนี้ได้มีโอกาศโหลดเจ้า Blide มาลองดูคับ เป็นที่หน้าพอใจมากครับ
ได้ interface ใหม่ๆสำหรับ blitzmax ของเราเลย มาดูตัวอย่างกันครับ

---------------------------------------------------------------------

เป็นไงบ้างครับ น่าหามาลองกันหน่อยไหม อิอิ
ดูขนาดเต็มที่นี้ http://uc.exteenblog.com/inoobna/images/Blide-01.JPG

edit @ 22 Apr 2009 14:39:02 by mycom

edit @ 22 Apr 2009 14:40:08 by mycom

edit @ 22 Apr 2009 14:40:37 by mycom

edit @ 22 Apr 2009 14:41:33 by mycom