home *** CD-ROM | disk | FTP | other *** search
- /* Sprite example
- ** --------------
- ** This example shows you how to set up a 16 colour AGA sprite with an
- ** X axis of 32 pixels.
- **
- ** The sprite is attached to the mouse, so try moving it around a bit.
- */
-
- MODULE 'games','games/games','exec/memory'
-
- PROC main()
- DEF screen:PTR TO gamescreen, palette:PTR TO INT, sparkie:PTR TO sprite,
- zbxy:LONG, timer:LONG
-
- palette := [
- $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,
- $0000,$0688,$0466,$0344,$0CC0,$0980,$0870,$0650,
- $01C2,$0050,$0B0B,$0606,$0F20,$0910,$0BBB,$0FFF,
- $00BF,$0068,$0568,$09BF,$0FF0,$0EE0,$0BA0,$0540
- ]:INT;
-
- screen := [
- GSV1,0, -> GameScreen Version
- 0,0,0, -> Screen_Mem1,2,3
- 0, -> ScreenLink
- palette, -> Address of Palette
- 0, -> Address of RasterList
- 32, -> Amount of colours
- 320,256, -> Screen Width, Height
- 0,0,0, -> Picture Width, Height
- 1, -> Amt_Planes
- 0,0, -> Top Of Screen, X/Y
- 0,0, -> X/Y pic offsets
- SPRITES OR NOSCRBDR, -> Special attributes
- LORES OR COL12BIT, -> Screen mode
- INTERLEAVED -> Screen type
- ]:gamescreen;
-
- sparkie := [
- SPV1,0, -> Version number
- 0, -> Bank Number 0
- 0, -> Ptr to graphic
- 100,100, -> Beginning X/Y positions
- 0, -> Current frame
- 32,21, -> Width, Height
- 16, -> Amt of colours
- 16, -> Colour start in palette
- 2, -> Amt of planes
- HIRES, -> Resolution attributes
- 0, -> Position in relation to playfields
- 0 -> Special attributes.
- ]:sprite;
-
- IF gmsbase := OpenLibrary('games.library',0)
- SetUserPrefs(0)
- IF (AddScreen(screen) = ERR_OK)
- sparkie.data := SmartLoad('GAMESLIB:data/sparkie32.raw',0,MEMF_CHIP)
- InitSprite(screen,sparkie)
- UpdateSprite(screen,sparkie)
- ShowScreen(screen)
- zbxy := ReadMouse(JPORT1)
-
- REPEAT
- IF (timer++ AND $1)
- IF (sparkie.frame = 5) THEN sparkie.frame := 0 ELSE sparkie.frame := sparkie.frame+1
- ENDIF
- zbxy := ReadMouse(JPORT1)
- sparkie.xpos := sparkie.xpos+getZBXYx(zbxy)
- sparkie.ypos := sparkie.ypos+getZBXYy(zbxy)
- WaitSVBL()
- UpdateSprite(screen,sparkie)
- UNTIL !(zbxy AND MB_LMB)
-
- FreeMemBlock(sparkie.data);
- DeleteScreen(screen)
- ENDIF
- CloseLibrary(gmsbase)
- ENDIF
- ENDPROC
-
-