Main Menu

Space firebird Mockup

Started by baggey, June 22, 2018, 01:25:05 AM

Previous topic - Next topic

baggey

So ive used no types. Would like to get bullets moving better maybe a need for velocity?
Ive tried a timer interupt type delay for firing bullets.

Heres the code


; PROJECT : firebird
; CREATED : 22/06/2018
; EDITED  : 22/06/2018
; ---------------------------------------------------------------------
setfps 180

openscreen 400,300,16,2

// limit number of bullets to
maxbullets = 6

// Setup arrays for bullets probably could use a type here?

Dim bulletfired(maxbullets)
Dim bulletx(maxbullets)
Dim bullety(maxbullets)

bulletcount = 0

// attempt at timer delay so bullets dont come out to fast ie on top of eachother
interupt=0

// set player position
playerx=192
playery=272

// Load images
spaceship = newfximage (15,15)  
bullet = newfximage (5,6)

loadimage "spaceship.png",spaceship,2
loadimage "bullet.png",bullet,2

// Set the Images Mask Colour (it's transparent colour) to Rgb(255,255,255) white
imageMaskColour spaceship,RGB(255,255,255)
  imageMaskColour bullet,RGB(255,255,255)

// Main loop
do

interupt = interupt +1

if leftkey() and playerx>0 then playerx=playerx-1
if rightkey() and playerx<381 then playerx=playerx+1
If Spacekey()=1 and interupt = 10 Then Gosub addaBullet
If BulletCount > 0 Then Gosub MoveBullet

lockbuffer
rendertoscreen
cls

drawrotatedimage spaceship,playerx,playery,0,1,1,1,1,1

for n=1 to maxbullets
If bulletfired(N)=1 then drawrotatedimage bullet,bulletx(n),bullety(n),0,1,1,1,1,1
next

unlockbuffer

sync

if interupt = 20 then interupt =0

loop

// Gosubs

addaBullet:
 For N = 1 To maxbullets
   If bulletfired(N)=0
     bulletfired(N)=1
     bulletx(N) = playerx +5
     bullety(N) = playery -4
     Inc BulletCount
     Exit
   Endif
 Next N
Return

MoveBullet:
 For N = 1 To MaxBullets
   If bulletfired(N)=1
    bullety(N)=bullety(N)-1
     // See if bullet is at top of screen
     If bullety(N) <= 0
       bulletfired(N) = 0
       Dec BulletCount
     Endif
   Endif
 Next N
 
Return



You'll need these two images as well

and the .ExE note exe dosent seem to work?

Jesus was only famous because of his dad

kevin

QuoteSo ive used no types. Would like to get bullets moving better maybe a need for velocity?
Ive tried a timer interupt type delay for firing bullets.

  Not too sure what you're trying to do with the the timing, but it'd be best to use a time past type of approach.   So interval between redraws has less impact.



Quoteand the .ExE note exe dosent seem to work?

   Runs here, although it does take a while.  Not a good idea to open in such and odd full screen exclusive mode.

   when attaching materials please ZIP them into a folder,  it's a lot easier on everyone

baggey

#2
 
Quoteand the .ExE note exe dosent seem to work?

   Runs here, although it does take a while.  Not a good idea to open in such and odd full screen exclusive mode.

[/quote]

The reason why i want this screen size is im trying to write and create retro stuff i dont want to be scalling and rezizing! yada yada! using clever fx stuff etc.

Why is the default size 800 x600? Why cant this be 320 x 240 / 256 x 192 etc? If we chosse to?
Jesus was only famous because of his dad

kevin


QuoteThe reason why i want this screen size is im trying to write and create retro stuff i dont want to be scalling and rezizing! yada yada! using clever fx stuff etc.

  Nobody has CRT monitors anymore, so LCD displays will scale it. 


QuoteWhy is the default size 800 x600? Why cant this be 320 x 240 / 256 x 192 etc? If we chosse to?

You set the default to whatever you want, but it's a lottery as to what hardware supports what.