• Welcome to Dark Bit Factory & Gravity.
 

Final Version of the Green Boxcopter Project

Started by Clanky, December 13, 2006

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Clanky

Finally finished the code... with full collision detection!!! OMG!
I was listening to music last night having a relax, when I realised that: "Wow, so that's how you would do that! Just... oh yes... hmmm, and this... yep! Completed!" lol
Wow. It was simple, but I wont tell you guys and girls because you may get confused as I myself am confused at how I would tell you... but it is simple nother the less!

I have attatched it, because I am not sure if it will fit on the page?
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

rain_storm

Nice Collision Detection Cant seem to keep the copter airbourne

Challenge Trophies Won:

Clanky

Huh! It should be in the middle of the sceen?
Can you fly the helicopter, or is it just that you hit the blocks?
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

rain_storm

I can't fly the thing it keeps plummeting to the ground. Perhaps I should be holding X instead of tapping it faster?

Challenge Trophies Won:

Shockwave

That caught me out the first time I played, holding X sorted it out. It's a great game. There's something quite charming about the simplicity of Yabasic games, we had a competition on the old ezboard to make a one button game before and some of the entries were really inventive.
Shockwave ^ Codigos
Challenge Trophies Won:

Stonemonkey

#5
Cool game, and nice smoke effect.

EDIT:739, level 5.2 and the walls had started to shake around.

Shockwave

My mistake, I just ran it again and you use the D-pad to move. It's a bit tricky in the emulator :)
Shockwave ^ Codigos
Challenge Trophies Won:

Clanky

woops!
Do you have to press the D-Pad??? Hmmm.... I thought it was X.
Well then. Cheers for the comments, and a Happy New Year to everyone!
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Clanky

OK. Yes, you need to press the D-Pad (UP) Button to fly the helecopter... note you can tap it.
I made it so you can slow it down with force=0.02 (Note: FORCE is force slow down...)

Updated Version is attatched.

Hope everyone likes the special sequences of the harder levels!

Cheers.
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

rain_storm

Love the smoke man,
This is still a very challenging game i find but at least I can control the chopper now, controls are smooth excellent work I'm gonna see if I can get off the first level.
:cheers:

Challenge Trophies Won:

Clanky

Ok, I had a read of your post rain_storm on the other topic... and I think I like the idea. I will start to make the Green Boxcopter game bigger!
Thanx for your insight, and I will be adding other special additions to the new one {hidden}, and if I need more explaining on the rotation and collisions, I know where to ask!
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

Shockwave

Will be cool.. In fact I found a very similar game to this and added it to the arcade, yours is better though :)
Shockwave ^ Codigos
Challenge Trophies Won:

rain_storm

I'm grad you're gonna add some more touches. If things get a little hairy I will help if I can, :cheers:

Challenge Trophies Won:

Clanky

Ok, I have finished one of the new additions - actually yesterday.
I think I will attatch both the old GB and the new one in the same post, so that people can compare them. Also, I think that I will make it so that the old one is called "Green Boxcopter: Equality" and the new one "Green Boxcopter: Seperation"... explainations in the Read Me.txt which I will attatch with the release of the new game.

I have a few other ideas which I am starting to write down and think about, this is comming along nicely! I will do the rotating blocks last - as they will be the most difficult!

Thanx!
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

rain_storm

Sounds like this project has been given a kick in the butt and things are moving foward, its nice to see. may I suggest sparks or something extra like that when the copter hits into something, you know fancy explosions and all that. That would be a nice addition

Challenge Trophies Won:

Clanky

Yep! Thanx Rain_Storm. I actually thought of this way back for the old game, but the effects made the game slow down dramatically.

So, I am trying to code a new faster model.

Here's the code... note that it - for some reason - doesn't work properly. It doesn't 'explode'... rather just falls in four blocks...


open window 640,512

part=100
dim px(part),py(part)
dim s(part),pd(part)
dim r(part),g(part),b(part)

label loop
  setdispbuf db
  db=1-db
  setdrawbuf db
  clear window
fire=fire+1
  if fire=100 onu=1
  if onu=1 then
    for i=1 to part
      grav=0
      px(i)=320:py(i)=256
      s(i)=ran(2)+2:pd(i)=int(ran(4))
      r(i)=ran(200)+50:g(i)=ran(50):b=ran(50)
    next i
    onu=2
  fi
  if onu=2 then
    for i=1 to part
      if pd(i)=0 then
        px(i)=px(i)+(ran(2)+2)
        py(i)=py(i)+(ran(2)+2)
      elsif pd(i)=1 then
        px(i)=px(i)+(ran(2)+2)
        py(i)=py(i)-(ran(2)+2)
      elsif pd(i)=2 then
        px(i)=px(i)-(ran(2)+2)
        py(i)=py(i)+(ran(2)+2)
      elsif pd(i)=3 then
        px(i)=px(i)-(ran(2)+2)
        py(i)=py(i)-(ran(2)+2)
      fi
      grav=grav+0.0015
      if grav>5 grav=5
      py(i)=py(i)+grav
      setrgb 1,r(i),g(i),b(i)
      fill rect px(i)-s(i),py(i)-s(i),px(i)+s(i),py(i)+s(i)
    next i
  fi
goto loop



I have part set to 100 so it shows more particles... it can be lowered though.
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

rain_storm

#16
you could boost that by only calculating one side (fowards or backwards) then draw the particals as they are relative to the crash point and a mirror image on the opposite side
Also ran() is slow so just randomise the movement values and store that to an array


open window 640,512

part=100
dim px(part),py(part)
dim s(part),pd(part)
dim r(part),g(part),b(part)
dim movex(part),movey(part)

label loop

  setdispbuf db
  db=1-db
  setdrawbuf db
  clear window

  fire=fire+1
  if fire=100 onu=1
  if onu=1 then
    for i=1 to part
      grav=0
      px(i)=000:
      py(i)=000
      s(i)=ran(2)+2:
      pd(i)=int(ran(4))
      r(i)=ran(200)+50:
      g(i)=ran(50):
      b=ran(50)
      if pd(i)=0 then
        movex(i) = ran(2) + 2
        movey(i) = ran(2) + 2
      elsif pd(i)=1 then
        movex(i) = ran(2) + 2
        movey(i) = -ran(2) - 2
      fi
    next i
    onu=2
  fi
  if onu=2 then
    for i=1 to part
      px(i)=px(i)+movex(i)
      py(i)=py(i)+movey(i)
      grav=grav+0.0015
      if grav>5 grav=5
      py(i)=py(i)+grav
      setrgb 1,r(i),g(i),b(i)
      fill rect 320+px(i)-s(i),265+py(i)-s(i),320+px(i)+s(i),256+py(i)+s(i)
      fill rect 320-px(i)-s(i),256+py(i)-s(i),320-px(i)+s(i),256+py(i)+s(i)
    next i
  fi
goto loop

Challenge Trophies Won:

Clanky

Thanx Rain, I'll take that into account.
But, there is one problem with my explosion... id doesn't seem to explode in 'all' directions. Just four blocks going:
1: Up and Left (With Grav Force Down)
2: Up and Right (With Grav Force Down)
3: Down and Left (With Grav Force Down)
4: Down and Right (With Grav Force Down)
And with your edited one, it has another just falling straight down...

Hmm... I will see what happens with a few other ways - I'm just hoping I can get a circle spray explosion.
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..

rain_storm

I know what you mean take a look at this code, the y movement values are randomised by two random values (one positive the other negative) whilst the x movement is simply randomised positively with an extra non random number added to it. note the end result displays this peculiar gap both below and above the explosion. Thats because the non random addition to the x axis forbids any partical from entering these zones try setting that non random value to zero and observe the results - The problem will dissappear  ;D


open window 640, 512
window origin "cc"
gravity = 0.01
size = 4
nonrandom_value = 2

00 parts = 50
   dim partx(parts), party(parts)
   dim movex(parts), movey(parts)
   for p = 0 to parts
      partx(p) = 000
      party(p) = 000
      movex(p) = ran(2) + nonrandom_value
      movey(p) = ran(2) - ran(2)
   next
   blast_radius = 0

01 setdispbuf draw
   draw = 1 - draw
   setdrawbuf draw
   clear window

02 if (blast_radius < 150) then
      setrgb 1, 255, 100, 100
      fill circle 0,0,blast_radius
      circle 0,0,blast_radius*2
      circle 0,0,blast_radius*3
      blast_radius = blast_radius + size
   fi


03 setrgb 1, 255, 000, 000
   for p = 0 to parts
      px = partx(p) + movex(p)
      py = party(p) + movey(p)
      fill box  px-size,py-size to  px+size, py+size
      fill box -px-size,py-size to -px+size, py+size
      partx(p) = px
      party(p) = py
      movey(p) = movey(p) + gravity
   next

04 if (inkey$(0) <> "") goto 00
   goto 01

Challenge Trophies Won:

Clanky

Yep. That is more of an explosion! Thanx.

But, I have seen a really nice explosion before done in YaBASIC... I just can't remember where it is! I think it was in the package Jim put together on the Yab Site...
It was really something! Full circle explosion, ahh - it was great! Now if I could just find it...

I think it may have used sin/cos to move the particles around... and, as I don't know how to use sin/cos very good it will be impossible for me to code it. So i needa find the explosion code... arg!

Thanx for your help Rain, very much appreciate it!!!
He tilts, and his eyes are focused on the ground far below.. Wind? Angels? Men..