Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / problem with sprites

Author
Message
KimoSabi
19
Years of Service
User Offline
Joined: 18th Jan 2005
Location:
Posted: 18th Jan 2005 11:09
i took some code out of the book(381-383) and i have been modifying it but it was used for 640x480 resolution and i want it at 1024x768 how can i change it so the sprites will go all the way across the screen (plz tell me wut variables or #'s to change)


Rem Project: Game
Rem Created: 1/16/2005 12:40:44 PM

Rem ***** Main Source File *****

CLS
Set Display Mode 1024,768,32
Load bitmap "planet.bmp",0
Sync on
Sync rate 30
DIM SpriteHit(20)
DIM SpriteTimer(1)
Hide Mouse
SpriteTimer(1) = 0
Load image "crosshair.bmp",25
LoadTargetAnims()

REM Start all of the sprites

For x = 2 to 20
For n = 0 to 560 step 10
Sprite x,-100,RND(n)+10,5
Next n
Set Sprite x,1,1
SpriteHit(x) = 0
Next x

REM Set the mouse cursor sprite

Set current bitmap 0
Green = RGB(255,0,255)
Red = RGB(255,0,0)
Black = RGB(0,0,0)
White = RGB(255,255,255)
Ink White,Black
inum = 5
Load Bitmap "sheild.bmp",30
Get Image 30,0,0,43,1020
Sprite 30,1000,0,30
Set current bitmap 0
Load Bitmap "line.bmp",29
Get Image 29,0,0,43,1020
Sprite 29,995,770,29
Set current bitmap 0

REM Set it to play until esc pressed

While Escapekey() = 0
ProcessSprites()
ControllerHandler()
Sync
Endwhile
End

REM This moves crosshairs to follow mouse

Function ControllerHandler()
Sprite 1, MouseX(), MouseY(), 25
If Mouseclick() = 1
For x = 2 to 20
If Sprite Collision(1,x)
SpriteHit(x) = 1
Endif
Next x
Endif
Endfunction

REM This is sprite collision stuff

Function ProcessSprites()
SpriteTimer(1) = SpriteTimer(1) - 1
If SpriteTimer(1) <= 0 Then MoveNewSprite()
For x = 2 to 20
If Sprite x(x) > 704
For n = 30 to 560 step 10
Sprite x,-100,RND(n),5
Next n
Endif
If SpriteHit(x)
Move Sprite 29,.5
Sprite x, Sprite x(x) + 5, Sprite y(x), Sprite Image(x) + 1
If Sprite Image(x) >= 15
For n = 30 to 560 step 10
Sprite x,-100,RND(n),5
Next n
SpriteHit(x) = 0
Endif
Else
If Sprite x(x) >= -64
Sprite x, Sprite x(x) + 5, Sprite y(x), 5
Endif
Endif
Next x
Endfunction

REM Moves a new sprite

Function MoveNewSprite()
For x = 2 to 20
If Sprite x(x) <= -100
Sprite x, -64, Sprite y(x), 5
x = 21
Endif
Next x
SpriteTimer(1) = 1
Endfunction

REM The target info

Function LoadTargetAnims()
Load Bitmap "explosion.bmp",1
inum = 5
fadestep = 100
Set Current Bitmap 1
For x = 0 to 10
Fade Bitmap 1,90
Get Image inum,0,0,43,56
inum = inum + 1
Next x
Delete Bitmap 1
Set Current Bitmap 0
Endfunction

I must say I am quite a »»ç¶´¬¬Géñíú§¬¬´¶««
Ali M Oldboy
19
Years of Service
User Offline
Joined: 6th Nov 2004
Location: England, UK
Posted: 22nd Jan 2005 04:19
If your signature says 'I must say I'm quite a genius' You should know - lol

Ali M

†††[ -- LoSt DrEaMs -- ]†††
wmf
19
Years of Service
User Offline
Joined: 6th Nov 2004
Location:
Posted: 24th Jan 2005 05:16
change this line: 'If Sprite x(x) > 704' to 'If Sprite x(x) > 1088'
then try it. there is probably more lines to change but I don't see them without running the code.

Login to post a reply

Server time is: 2024-09-23 10:12:32
Your offset time is: 2024-09-23 10:12:32