Guidance
指路人
g.yi.org
Guidance Forums / Rapid-Q Basic / Animated Gif - Whatever i do it doesn't work !

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Animated Gif - Whatever i do it doesn't work !
#4864
Posted by: 2004-07-21 00:36:32
My problem is this one, i am making a turn based fighting game with Animated gif as cutscenes.

but even if i make it like the examples, it just doesn't do anything.
my guess is i do something wrong. so i tryed a lot of other things trying everything i knoe up to now but there is no real example explaining in detail how it works what each thing does. so i'm lost in it.

here is a sample of my code...

'********************************************* APP TYPE & INCLUDES
$APPTYPE GUI
$INCLUDE "Rapidq.inc"
$INCLUDE "QIni.Inc"

'********************************************* DECLARE SUBS & FUNCTIONS
DECLARE SUB DXTimerExpired
DECLARE SUB SubBtn1Clicked
DECLARE SUB SubBtn2Clicked
DECLARE SUB SubBtn3Clicked
DECLARE SUB SubBtn4Clicked
DECLARE SUB SubBtn5Clicked
DECLARE SUB SubBtn6Clicked
DECLARE SUB SubMenuBtnInit
DECLARE SUB SubFrmMainPaint
DECLARE SUB SubMenuState (State AS STRING)
DECLARE SUB SubMenuProcess (Btn AS STRING)
DECLARE SUB SubCutScene (CutScene AS STRING)
DECLARE SUB SubStateChange (StateType AS STRING, Player AS STRING, State AS STRING)
'********************************************* DIM FORMS & VARIABLES
DIM FrmMain AS QForm
DIM DXGame AS QDXScreen
DIM OleCutScene AS QOleContainer
DIM PanGame AS QPanel
DIM ImaMenu AS QImage
DIM ImaChat AS QImage
DIM DXTimer AS QDXTimer
DIM DXIList AS QDXImageList
DIM DXP1IList AS QDXImageList
DIM Btn1 AS QCoolBtn
DIM Btn2 AS QCoolBtn
DIM Btn3 AS QCoolBtn
DIM Btn4 AS QCoolBtn
DIM Btn5 AS QCoolBtn
DIM Btn6 AS QCoolBtn
DIM IniFiles AS QIni
DIM IniP1Files AS QIni
DIM VarTheme AS STRING
DIM VarGState AS STRING
DIM VarCState AS STRING
DIM VarCFrame AS INTEGER
DIM VarCFrameX AS INTEGER
DIM VarCFrameY AS INTEGER
DIM VarCFrameID AS INTEGER
DIM VarFrameNum AS INTEGER
DIM VarP1CFrame AS INTEGER
DIM VarP1CFrameX AS INTEGER
DIM VarP1CFrameY AS INTEGER
DIM VarP1CFrameID AS INTEGER
DIM VarP1FrameNum AS INTEGER
DIM VarP1State AS STRING
DIM VarMenuState AS STRING
DIM VarMenuBtn1 AS STRING
DIM VarMenuBtn2 AS STRING
DIM VarMenuBtn3 AS STRING
DIM VarMenuBtn4 AS STRING
DIM VarMenuBtn5 AS STRING
DIM VarMenuBtn6 AS STRING
DIM VarCutSceneTime AS INTEGER
DIM VarCutSceneTimeLeft AS INTEGER
'********************************************* INITIALIZATION FORMS & VARIABLES
FrmMain.Enabled = True
FrmMain.BorderStyle = BsDialog
FrmMain.Center
FrmMain.width=485
FrmMain.height=390
FrmMain.Caption="FIGHT FOR FREEDOM"
FrmMain.OnPaint = SubFrmMainPaint
PanGame.Parent = FrmMain
PanGame.Top = 0
PanGame.Left = 0
PanGame.Width = 320
PanGame.Height = 240
DxGame.Parent = PanGame
DxGame.Top = 0
DxGame.Left = 0
DxGame.Width = 320
DxGame.Height = 240
DxGame.Init(320, 240)
OleCutScene.Parent = FrmMain
OleCutScene.Height = 240
OleCutScene.Width = 320
OleCutScene.Left = 0
OleCutScene.CreateObject("Gif89.Gif89.1")
        '-- FileName is a property in GIF89.DLL
OleCutScene.FileName = "Present.Gif" '+ IniFiles.Get("CutScene", "")
Btn1.Parent = FrmMain
Btn1.Top = 260
Btn1.Left = 20
Btn1.Width = 90
Btn1.Height = 35
Btn1.Flat = 1
Btn1.Onclick = SubBtn1Clicked
Btn2.Parent = FrmMain
Btn2.Top = 260
Btn2.Left = 115
Btn2.Width = 90
Btn2.Height = 35
Btn2.Flat = 1
Btn2.Onclick = SubBtn2Clicked
Btn3.Parent = FrmMain
Btn3.Top = 260
Btn3.Left = 210
Btn3.Width = 90
Btn3.Height = 35
Btn3.Flat = 1
Btn3.Onclick = SubBtn3Clicked
Btn4.Parent = FrmMain
Btn4.Top = 305
Btn4.Left = 20
Btn4.Width = 90
Btn4.Height = 35
Btn4.Flat = 1
Btn4.Onclick = SubBtn4Clicked
Btn5.Parent = FrmMain
Btn5.Top = 305
Btn5.Left = 115
Btn5.Width = 90
Btn5.Height = 35
Btn5.Flat = 1
Btn5.Onclick = SubBtn5Clicked
Btn6.Parent = FrmMain
Btn6.Top = 305
Btn6.Left = 210
Btn6.Width = 90
Btn6.Height = 35
Btn6.Flat = 1
Btn6.Onclick = SubBtn6Clicked
DXTimer.Enabled = True
DXTimer.Interval = 10
DXTimer.OnTimer = DXTimerExpired

DXIList.Parent = DXGame
DXP1IList.Parent = DXGame

ImaMenu.BMP = CurDir$ + "\Gfx\Menu.bmp"
ImaChat.BMP = CurDir$ + "\Gfx\Chat.bmp"
SubFrmMainPaint
SubCutScene("Present")

'********************************************* SHOWING THE PROGRAM
FrmMain.ShowModal
OleCutScene.Free

SUB SubBtn1Clicked
    SubMenuProcess("Btn1")
END SUB

SUB SubBtn2Clicked
    SubMenuProcess("Btn2")
END SUB

SUB SubBtn3Clicked
    SubMenuProcess("Btn3")
END SUB

SUB SubBtn4Clicked
    SubMenuProcess("Btn4")
END SUB

SUB SubBtn5Clicked
    SubMenuProcess("Btn5")
END SUB

SUB SubBtn6Clicked
    SubMenuProcess("Btn6")
END SUB

SUB SubMenuProcess (Btn AS STRING)
    IniFiles.FileName = CurDir$ + "\Menu\Menu.ini"
    IniFiles.Section = VarCState
    IF IniFiles.Get(Btn + "Func", "") = "StateChange Game MadeBy" THEN SubStateChange("Game", "", "MadeBy")
    IF IniFiles.Get(Btn + "Func", "") = "StateChange Game Title" THEN SubStateChange("Game", "", "Title")
    IF IniFiles.Get(Btn + "Func", "") = "StateChange Game Options" THEN SubStateChange("Game", "", "Options")
END SUB

SUB SubFrmMainPaint
    FrmMain.Draw(0, 240, ImaMenu.bmp)
    FrmMain.Draw(320, 0, ImaChat.bmp)
END SUB

SUB SubCutScene (CutScene AS STRING)
    IniFiles.FileName = CurDir$ + "\Anims\Anims.ini"
    IniFiles.Section = CutScene
    VarCutSceneTime = IniFiles.Get("CutSceneTime", "")
    VarCutSceneTimeLeft = 0
    PanGame.Visible = 0
 
    'OleCutScene.FileName = CurDir$ + "\Anims\Present.Gif"
END SUB

SUB SubMenuState (State AS STRING)
    IniFiles.FileName = CurDir$ + "\Menu\Menu.ini"
    IniFiles.Section = State
    Btn1.Bmp = CurDir$ + "\Menu\" + IniFiles.Get("Btn1Bmp", "")
    Btn2.Bmp = CurDir$ + "\Menu\" + IniFiles.Get("Btn2Bmp", "")
    Btn3.Bmp = CurDir$ + "\Menu\" + IniFiles.Get("Btn3Bmp", "")
    Btn4.Bmp = CurDir$ + "\Menu\" + IniFiles.Get("Btn4Bmp", "")
    Btn5.Bmp = CurDir$ + "\Menu\" + IniFiles.Get("Btn5Bmp", "")
    Btn6.Bmp = CurDir$ + "\Menu\" + IniFiles.Get("Btn6Bmp", "")
    Btn1.Enabled = VAL(IniFiles.Get("Btn1Up", ""))
    Btn2.Enabled = VAL(IniFiles.Get("Btn2Up", ""))
    Btn3.Enabled = VAL(IniFiles.Get("Btn3Up", ""))
    Btn4.Enabled = VAL(IniFiles.Get("Btn4Up", ""))
    Btn5.Enabled = VAL(IniFiles.Get("Btn5Up", ""))
    Btn6.Enabled = VAL(IniFiles.Get("Btn6Up", ""))
    VarMenuState = State
END SUB


SUB SubStateChange (StateType AS STRING, Player AS STRING, State AS STRING)
    'SubMenuState(State)
    'VarGState = StateType
    'VarCState = State
    'IF StateType = "Game" THEN
    '    IniFiles.FileName = CurDir$ + "\Anims\Anims.ini"
    '    IniFiles.Section = State
    '    DXIList.LoadFromFile( CurDir$ + "\Anims\" + State + ".dxg")
    '    VarFrameNum = VAL(IniFiles.Get("FrameNum", ""))
    '    VarCFrame = 1
    'END IF
    'IF StateType = "Player" THEN
    '    IF Player = "P1" THEN
    '        IniP1Files.FileName = CurDir$ + "\Chars\TheDummy\Anims.ini"
    '        IniP1Files.Section = State + "_P1"
    '        DXP1IList.LoadFromFile( CurDir$ + "\Chars\TheDummy\TheDummy.dxg")
    '        VarP1State = State
    '        VarP1CFrame = 1
    '        VarP1FrameNum = VAL(IniP1Files.Get("FrameNum", ""))
    '        VarFrameTime = VAL(IniFiles.Get("Frame" + STR$(VarCFrame) + "Time", ""))
    '        VarFrameTimeLeft = 0
    '    ELSEIF Player = "P2" THEN
    '        IniP2Files.FileName = CurDir$ + "\Chars\TheDummy\Anims.ini"
    '        IniP2Files.Section = State
    '        DXP2StateIList.LoadFromFile( CurDir$ + "\Chars\TheDummy\TheDummy.dxg")
    '        VarP2State = State
    '        VarP2StateCFrame = 1
    '    END IF
    'END IF
END SUB

SUB DXTimerExpired
    'IF VarGState = "Game" THEN
    '    IF VarCFrame > VarFrameNum THEN
    '        IF VarCState = "MadeBy" THEN SubStateChange("Game", "", "Title")
    '        VarCFrame = 1
    '        VarFrameTime = VAL(IniFiles.Get("Frame" + STR$(VarCFrame) + "Time", ""))
    '    END IF
    '    VarCFrameX = VAL(IniFiles.Get("Frame" + STR$(VarCFrame) + "X", ""))
    '    VarCFrameY = VAL(IniFiles.Get("Frame" + STR$(VarCFrame) + "Y", ""))
    '    VarCFrameID = VAL(IniFiles.Get("Frame" + STR$(VarCFrame) + "ID", ""))
    '    DXIList.Draw(VarCFrameID, VarCFrameX, VarCFrameY, 0)
    '    'DXGame.TextOut (10, 10, "X : " + STR$(VarCFrameX) + "   Y : " + STR$(VarCFrameY) + "  ID : " + STR$(VarCFrameID)+ "     MAX : " + STR$(VarFrameNum) + "   Anim : " + VarCState, clRed, -1)
        'DXGame.TextOut (10, 30, "X : " + STR$(MouseX) + "   Y : " + STR$(MouseY), clRed, -1)
    '    IF VarFrameTimeLeft > VarFrameTime THEN
    '        INC(VarCFrame, 1)
    '        VarFrameTime = VAL(IniFiles.Get("Frame" + STR$(VarCFrame) + "Time", ""))
    '        VarFrameTimeLeft = 0
    '    ELSE
    '        INC(VarFrameTimeLeft, 1)
    '    END IF
    'ELSEIF VarGState = "Player" THEN
    '    VarP2StateFrameNum = VAL(IniP2Files.Get("FrameNum", ""))
    '    If VarP1CFrame > VarP1FrameNum Then VarP1CFrame = 1
    '    VarP1CFrameX = VAL(IniP1Files.Get("Frame" + STR$(VarP1CFrame) + "X", ""))
    '    VarP1CFrameY = VAL(IniP1Files.Get("Frame" + STR$(VarP1CFrame) + "Y", ""))
    '    VarP1CFrameID = VAL(IniP1Files.Get("Frame" + STR$(VarP1CFrame) + "ID", ""))
    '    VarP2StateCFrameX = VAL(IniP2Files.Get("Frame" + STR$(VarGStateCFrame) + "X", ""))
    '    VarP2StateCFrameY = VAL(IniP2Files.Get("Frame" + STR$(VarGStateCFrame) + "Y", ""))
    '    VarP2StateCFrameID = VAL(IniP2Files.Get("Frame" + STR$(VarGStateCFrame) + "ID", ""))
    '    DXP1IList.Draw(VarP1CFrameID, VarP1CFrameX, VarP1CFrameY, 0)
    '    DXMenu.TextOut (10, 10, "X : " + STR$(VarP1CFrameX) + "   Y : " + STR$(VarP1CFrameY) + "  ID : " + STR$(VarP1CFrameID)+ "     MAX : " + STR$(VarP1FrameNum) + "   Anim : " + VarCState, clWhite, clBlack)
    '    DXP2StateIList.Draw(VarP2StateCFrameID, VarP2StateCFrameX, VarP2StateCFrameY, 0)
    '    INC(VarP1CFrame, 1)
    '    INC(VarP2StateCFrame, 1)
    'END IF
    'DXGame.Flip
END SUB






Sorry, there is a lot of things in there and many of it just doesn't cut it, but the cutscene is still supposed to come up and it doesn't ! so i'm lost and am desperate to get any info on the animated gif dll that is supposed to work with rapid-q !

thanks in advance for your help and i hope to get an answer soon.
Message2. Re: Animated Gif - Whatever i do it doesn't work !
#4871
Posted by: 2004-07-21 20:16:45
I prefer to do animation differently (not fond of animated GIF's). For my game DIONA'S EYE (which you can get from www.dominategame.com by clicking on the GHOTI'S GAME download thingy) I produced an animated block by extracting the animation frames of a GIF (using the freeware tool IrfanView which you can get at www.irfanview.com ) and using those to make an animated block.

Below is the code (edited) I used to put the animated block in the game; using $Resource is good because it puts the graphics in the EXE file - then there are no external files with the program.

 $RESOURCE steen11 AS "R_1.bmp"
 $RESOURCE steen12 AS "R_2.bmp"
 $RESOURCE steen13 AS "R_3.bmp"
 $RESOURCE steen14 AS "R_4.bmp"
 $RESOURCE steen15 AS "R_5.bmp"
 $RESOURCE steen16 AS "R_6.bmp"
 $RESOURCE steen17 AS "R_7.bmp"
 $RESOURCE steen18 AS "R_8.bmp"
 $RESOURCE steen19 AS "R_9.bmp"
 $RESOURCE steen20 AS "R_A.bmp"
 $RESOURCE steen21 AS "R_B.bmp"
 $RESOURCE steen22 AS "R_C.bmp"

 DIM bl(22) AS QIMAGE
 bl(11).BMPhandle = steen11
 bl(12).BMPhandle = steen12
 bl(13).BMPhandle = steen13
 bl(14).BMPhandle = steen14
 bl(15).BMPhandle = steen15
 bl(16).BMPhandle = steen16
 bl(17).BMPhandle = steen17
 bl(18).BMPhandle = steen18
 bl(19).BMPhandle = steen19
 bl(20).BMPhandle = steen20
 bl(21).BMPhandle = steen21
 bl(22).BMPhandle = steen22

 DECLARE SUB zee (sender AS QTIMER)

 DIM golf AS QTIMER
 golf.interval = 340
 golf.enabled = 1
 golf.ontimer = zee

 SUB zee (sender AS QTIMER)
  fp=fp+1 : IF fp>12 THEN fp=1
  Image.draw (1,1,bl(10+fp).BMP)
 END SUB
By switching the timer GOLF on you switch the animation on. As you can see from my game its a simple looped animation (just 12 frames) the speed of which can be controlled by by changing the golf.interval value.

If you have different animations then select between them by changing the "base number" in the sub that does the animation (the 10+ bit in this sample code).
Message3. Re: Animated Gif - Whatever i do it doesn't work !
#4875
Posted by: 2004-07-22 00:21:46
Thing is , my game is supposed to be highly customizable !
so i cannot use the $resource thing. and for the animated gifs, well it was just for cutscenes, i already got my animation routine up for the rest of my game.

but thanks anyway, think i'll just try something else then.
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥1,420.00 ·
 
 
¥950.00 ·
 
 
¥288.00 ·
 
 
¥738.00 ·
 
 
¥397.00 ·
 
 
¥750.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0