Author Topic: Blitz2D, first program HELP!  (Read 27119 times)

0 Members and 1 Guest are viewing this topic.

Offline billy bob

  • C= 64
  • **
  • Posts: 36
  • Karma: 10
    • View Profile
Re: Blitz2D, first program HELP!
« Reply #20 on: July 09, 2009 »
Another question: How do you make different things happen when levels go up?  ???

Sorry, I am probably getting annoying asking these questions.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Blitz2D, first program HELP!
« Reply #21 on: July 09, 2009 »
Well, for instance you can make the baddies go twice as fast by multiplying their speed by the level number. :)  In general, you can use the level number as a difficulty factor.

Jim
Challenge Trophies Won:

Offline billy bob

  • C= 64
  • **
  • Posts: 36
  • Karma: 10
    • View Profile
Re: Blitz2D, first program HELP!
« Reply #22 on: July 09, 2009 »

    Thanks, could I have the code for that, and where to put it ???

    I will understand this when someone tells me and I will not post as many questions.

    Thanks! :)

   

Offline zawran

  • Sponsor
  • Pentium
  • *******
  • Posts: 909
  • Karma: 67
    • View Profile
Re: Blitz2D, first program HELP!
« Reply #23 on: July 09, 2009 »
Quote
could I have the code for that, and where to put it

Sorry for being a bit off the topic, but thats usually not the way to go about things. Please try something out first, then if that does not work, post back with what you got and someone will assist with making things right.

I fully understand that it can be difficult to get started with programming, but getting things served on a platter does not help on your overall understanding of how things work. If your project seems a bit too much, then perhaps try something simpler and work your way up.

I hope you do not feel like I am stepping on toes here, its truely ment as a constructive comment.

Offline billy bob

  • C= 64
  • **
  • Posts: 36
  • Karma: 10
    • View Profile
Re: Blitz2D, first program HELP!
« Reply #24 on: July 09, 2009 »
Yes, I have actually tried lots of things already, I took this opportunity of asking as a last resort. ;)

What I meant to say is: "Could you tell me the code for that and tell me the place to put it."

And I do observe your help lots.

What do you suggest would be simpler? :kewl:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Blitz2D, first program HELP!
« Reply #25 on: July 09, 2009 »
If your level goes 1,2,3,4,5 etc, this will make the aliens move faster
a\x = a\x + amx * level

Jim
Challenge Trophies Won:

Offline billy bob

  • C= 64
  • **
  • Posts: 36
  • Karma: 10
    • View Profile
Re: Blitz2D, first program HELP!
« Reply #26 on: July 10, 2009 »

    OK, I have calculated where to put it, it is now done, and it also makes sense. :kewl:

    Estimation of what it means: a\x means alien going across x axis and equaling speed multiplied by amount of levels.

   I hope my estimation is true.  ;) :D

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17409
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Blitz2D, first program HELP!
« Reply #27 on: July 10, 2009 »
Sounds about right Billy Bob! :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline ferris

  • Pentium
  • *****
  • Posts: 841
  • Karma: 84
    • View Profile
    • Youth Uprising Home
Re: Blitz2D, first program HELP!
« Reply #28 on: July 23, 2009 »
And don't at all think that asking questions here is annoying...that's what this board was built for!!
http://iamferris.com/
http://youth-uprising.com/

Where the fun's at.
Challenge Trophies Won:

Offline billy bob

  • C= 64
  • **
  • Posts: 36
  • Karma: 10
    • View Profile
More problems.
« Reply #29 on: November 04, 2009 »
It's been a while and I have had a couple of problems.

1. I'm trying to get an image to randomly appear on screen (called "Power"), but I don't know how to, I have tried allot of things.

2. I want to replace "While Not KeyDown(1)" with "If Keyhit(1) then lives = lives - 3" but then an error comes up instead of the result I looking for.

Sorry if I am asking for too much help.

« Last Edit: November 04, 2009 by Jim »

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: More problems.
« Reply #30 on: November 04, 2009 »
when you say randomly appear, are you meaning pixels of a certain size ( eg rectangles / tiles ) need to fade onto the screen to form the full image, and these portions are randomly chosen?

it looks to me if your using Blitz, infact Blitz Max; with your key stuff 1 is escape in BMAX, previous Blitz versions used 27. so i'd recommend using a different key for incrementing your lives variable.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline billy bob

  • C= 64
  • **
  • Posts: 36
  • Karma: 10
    • View Profile
Re: More problems.
« Reply #31 on: November 05, 2009 »
when you say randomly appear, are you meaning pixels of a certain size ( eg rectangles / tiles ) need to fade onto the screen to form the full image, and these portions are randomly chosen?

Sorry, I don't quite understand what you mean.

What I meant was:

"I want a full image to randomly appear on screen in different places every twenty seconds, I also want that image to disappear when the image has been there for four seconds."

Just say if you still don't know what I mean.

it looks to me if your using Blitz, infact Blitz Max; with your key stuff 1 is escape in BMAX, previous Blitz versions used 27. so i'd recommend using a different key for incrementing your lives variable.

OK, thanks.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Blitz2D, first program HELP!
« Reply #32 on: November 05, 2009 »
You can try something like this (not real code, but you can work it)
Code: [Select]
mode=0 (0 == waiting to display, 1 == displaying)
endtime = millisecs()+20000   (this is 20 seconds after now)
repeat
  if millisecs() > endtime then
    if mode=0 then
      display_random_picture()
      endtime=millisecs()+4000  (this is 4 seconds after now)
      mode=1
   else if mode = 1 then
      turn_off_picture()
      endtime=millisecs()+20000
      mode=0
   end if
  end if
until keydown
end

function display_random_picture()
  x=rand(0,640)
  y=rand(0,480)
  drawimage image,x,y
end function

Jim
Challenge Trophies Won:

Offline billy bob

  • C= 64
  • **
  • Posts: 36
  • Karma: 10
    • View Profile
(...)
« Reply #33 on: November 05, 2009 »
Thanks Jim, people really are helpful here. :D

Hopefully I can make your help turn into proper blitz2D code.  ;)

Offline billy bob

  • C= 64
  • **
  • Posts: 36
  • Karma: 10
    • View Profile
Re: Blitz2D, first program HELP!
« Reply #34 on: November 05, 2009 »
Well, there is an error I can't fix.

I have changed your code into:

mode=0 ;(0 == waiting To display, 1 == displaying)
endtime = MilliSecs()+20000   ;(this is 20 seconds After now)
Repeat
  If MilliSecs() > endtime Then
    If mode=0 Then
      display_random_picture()
      endtime=MilliSecs()+4000  ;(this is 4 seconds After now)
      mode=1
   Else If mode = 1 Then
      turn_off_picture()
      endtime=MilliSecs()+20000
      mode=0
   End If MilliSecs
  End If
Until KeyDown
End

  If Function display_random_picture()
  x=Rand(0,640)
  y=Rand(0,480)
  DrawImage image,x,y
End Function

Also, the error that comes up is: "Expecting expression".

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Blitz2D, first program HELP!
« Reply #35 on: November 05, 2009 »
I'm guessing it's here
Until KeyDown
I think Blitz wants the key
Until KeyDown(1)
or something.

Jim


Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Blitz2D, first program HELP!
« Reply #36 on: November 05, 2009 »
your getting a little lost dude, I'll have a go for you.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline billy bob

  • C= 64
  • **
  • Posts: 36
  • Karma: 10
    • View Profile
Re: Blitz2D, first program HELP!
« Reply #37 on: November 05, 2009 »
I think Blitz wants the key
Until KeyDown(1)

Thanks, but it still doesn't work.....

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Blitz2D, first program HELP!
« Reply #38 on: November 05, 2009 »
Try this on for size dude :)

Code: [Select]
Graphics 640,480
SetBuffer BackBuffer()
SeedRnd MilliSecs()

; create test image
image_one=CreateImage(64,64)

SetBuffer ImageBuffer(image_one)
For a=0 To 2000
Color Rand(0,255),Rand(0,255),Rand(0,255)
Plot Rand(0,ImageWidth(image_one)-1),Rand(0,ImageHeight(image_one)-1)
Next
SetBuffer BackBuffer()

;DrawImage image_one,0,0
;Flip
;WaitKey

ESC_KEY=1
mode=0

image_x=Rand(0,639-ImageWidth (image_one))
image_y=Rand(0,439-ImageHeight(image_one))

picture_timer=MilliSecs()

While Not KeyDown(ESC_KEY)
Cls

If ( picture_timer + 20000 ) <=MilliSecs()
If mode=0 Then
image_x=Rand(0,639-ImageWidth (image_one))
image_y=Rand(0,439-ImageHeight(image_one))
mode=1
picture_timer=MilliSecs();
End If
End If

If ( picture_timer + 4000 ) <=MilliSecs()
If mode=1 Then
mode=0
picture_timer=MilliSecs()
End If
End If

If mode=0 Then DrawImage( image_one, image_x, image_y)

Flip
Wend

Havent used Blitz in years.
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline billy bob

  • C= 64
  • **
  • Posts: 36
  • Karma: 10
    • View Profile
Re: Blitz2D, first program HELP!
« Reply #39 on: November 06, 2009 »
Thanks Clyde :) , I will try to put that into the rest of the code, I will ask for help if I can't. ;)