News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

BOTS - Brotherhood Of The Solarbeetles

Started by stef, July 09, 2006, 07:16:47 AM

Previous topic - Next topic

stef

Hi!

This is one of my better ideas   :rolleyes:   ( it's of course not my "Great Gameidea"! :) )

The prog below is a little bit chaotic. It's more a sketch to see motion and colours

You'll see some simple "crawlers" .

The animations are realtime calculated.


Greetings
stef

PlayBASIC Code: [Select]
; PROJECT : bots1
; AUTHOR : stef
; CREATED : 04.07.2006
; EDITED : 09.07.2006
; ---------------------------------------------------------------------

;made with PB V1.44

Global sw=800
Global sh=600
LoadFont "comic sans ms",2,48,1
LoadFont "comic sans ms",3,600,1

SetFont 2

;OpenScreen 800,600,32,2
;ScreenVsync On
SetFPS 30

Global grey30= RGB(30,30,30)
Global grey60= RGB(60,60,60)
Global grey90= RGB(90,90,90)
Global grey120= RGB(120,120,120)

Global bs=50
Global lh=400;levelheight
Global factor=1

;Global ind
Global number=17;bots= number+1

Global backgroundim

Type theadcol
col
EndType

Type thead
headcol As theadcol
EndType

Dim head(5) As thead

Type tleg
short
EndType

Dim leg As tleg



Type position
x,y
EndType

Type tbots
image
sp
legang#
factor
imx,imy
botpos As position
pos1 As position
pos2 As position
pos3 As position
height
EndType


Dim bot(number) As tbots

Global bot

background()
partsdrawing()

Global ind

For ind= 0 To number
bot(ind).imx=3*bs
bot(ind).imy=3*bs

bot(ind).pos1.x=bot(ind).imx/2+10
bot(ind).pos1.y=bot(ind).imy/2-4
bot(ind).pos2.x=bot(ind).imx/2
bot(ind).pos2.y=bot(ind).imy/2-4
bot(ind).pos3.x=bot(ind).imx/2-10
bot(ind).pos3.y=bot(ind).imy/2-4
bot(ind).factor=1


Next
;----------------------------------------------------------------loop
Do

botcalc()


RenderToScreen
Cls 0

DrawImage backgroundim,0,0,0

DrawAllSprites

Sync

DeleteALLSprites
Loop
WaitKey
;----------------------------------------------------------------------

Function botcalc()
For ind = 0 To number

bot(ind).botpos.y=400
bot(ind).botpos.x=bot(ind).botpos.x+3
If bot(ind).botpos.x>=number*60+sw Then bot(ind).botpos.x=0

bot(ind).legang#=bot(ind).legang#+RndRange(3,5)*bot(ind).factor

If bot(ind).legang#<=-15
bot(ind).factor=1

EndIf

If bot(ind).legang#>=15
bot(ind).factor=-1

EndIf

botdraw()
Next

EndFunction


Function botdraw()

bot(ind).image=1000+ind
CreateFXImage bot(ind).image,bot(ind).imx,bot(ind).imy
RenderToImage bot(ind).image


DrawRotatedImage leg.short,bot(ind).pos1.x,bot(ind).pos1.y,bot(ind).legang#,1,1,-10,0,1;5=10/2
DrawRotatedImage leg.short,bot(ind).pos3.x,bot(ind).pos3.y,bot(ind).legang#,1,1,-10,0,1
DrawRotatedImage leg.short,bot(ind).pos2.x,bot(ind).pos2.y,-bot(ind).legang#,1,1,-10,0,1;middle at end, outside

DrawRotatedImage head(Mod(ind,6)).headcol.col,bot(ind).imx/2,bot(ind).imy/2+Rnd(2),0,1,1,-bs/2,-bs/2,1
Login required to view complete source code




Ian Price

Those beetles are incredibly cute and are animated nicely.

Nice one :)
I came. I saw. I played some Nintendo.

kevin

Now that's just too cute for words,  Expertly written also !

tomazmb

Hello,

It's very nice demo.

Have a nice day,

Tomaz
My computer specification:

AMD Athlon 64 2800+
MB ASUS K8V Socket 754 VIA K8T800
SB Audigy 2
3 GB RAM DDR 400 MHz PQI
AGP NVIDIA GeForce 7600GT 256 MB-Club 3D
Windows XP Pro SP2
DirectX 9.0c

thaaks

Respect!
Looks really cool - I like their wobbly walk and the tricks you did to draw the background picture!

Cheers,
Tommy

kevin

#5
Btw, it's prolly better to zip up future snippets and upload them to the code tank.

PlayBASIC Source Codes

thaaks

It would be cool if the forum could show the latest entries in the code tank so that regular forum visitors could immediately find out that there is some new entry in the code tank.
Or people post in the forums that they added something to the code tank...

Ian Price

#7
Those bugs kind of remind me of the AT-TEs in Star Wars: Revenge of the Sith

I came. I saw. I played some Nintendo.

Big C.

#8
QuoteBtw, it's prolly better to zip up future snippets and upload them to the code tank.



Yes it's a good idea but PBCT has no possibilities to update or delete older Versions in the moment...  ;)

QuoteIt would be cool if the forum could show the latest entries in the code tank so that regular forum visitors could immediately find out that there is some new entry in the code tank.

Also a good Idea... Can we have an own Forum for PBCT - News, Updates, Bugs, Requests ?

stef

#9
Hi!

Thanks to all for replies!

@Kevin
Maybe I will upload a mousecontrolled "walker"-animation the next days.

@Ian

Those bugs are of course artificial beings in an artificial world.

Only at the first look they are similar to the AT-TE
(the "walker"-animation looks even more like walking AT_TEs)

But my bugs have only 3 legs and no gun!  :)  (at least at this time!)

And can an AT-TE do this: :)  (see code below)

Greetings
stef

PlayBASIC Code: [Select]
; PROJECT : bots2
; AUTHOR : stef
; CREATED : 09.07.2006
; EDITED : 09.07.2006
; ---------------------------------------------------------------------



;made with PB V1.44

Global sw=800
Global sh=600

;OpenScreen 800,600,32,2
;ScreenVsync On
SetFPS 30

Global grey30= RGB(30,30,30)
Global grey60= RGB(60,60,60)
Global grey90= RGB(90,90,90)
Global grey120= RGB(120,120,120)

Global bs=50
Global lh=400;levelheight
Global factor=1

;Global ind
Global number=18;bots= number+1

Global backgroundim

Type theadcol
col
EndType

Type thead
headcol As theadcol
EndType

Dim head(5) As thead

Type tparts
leg
joint
foot
EndType

Dim part As tparts



Type position
x,y
EndType

Type tbots
image
sp
legang#
factor
imx,imy
botpos As position
pos1 As position
pos2 As position
pos3 As position
height
EndType


Dim bot(number) As tbots

Global bot

background()
partsdrawing()

Global ind

For ind= 0 To number
bot(ind).imx=3*bs
bot(ind).imy=3*bs

bot(ind).pos1.x=bot(ind).imx/2+10
bot(ind).pos1.y=bot(ind).imy/2+4
bot(ind).pos2.x=bot(ind).imx/2
bot(ind).pos2.y=bot(ind).imy/2+4
bot(ind).pos3.x=bot(ind).imx/2-10
bot(ind).pos3.y=bot(ind).imy/2+4
bot(ind).factor=1
bot(ind).botpos.y=400-bs/2

Next
;----------------------------------------------------------------loop
Do

botcalc()


RenderToScreen
Cls 0

DrawImage backgroundim,0,0,0

DrawAllSprites

Sync

DeleteALLSprites
Loop
WaitKey
;----------------------------------------------------------------------

Function botcalc()
For ind = 0 To number


bot(ind).botpos.x=bot(ind).botpos.x+2
bot(ind).botpos.y=bot(ind).botpos.y-Rnd(2)

If bot(ind).botpos.x>=number*60+sw Then bot(ind).botpos.x=0
If bot(ind).botpos.y<=0 Then bot(ind).botpos.y=600

bot(ind).legang#=bot(ind).legang#+RndRange(1,4)*bot(ind).factor



If bot(ind).legang#<=60
bot(ind).factor=1

EndIf

If bot(ind).legang#>=90
bot(ind).factor=-1

EndIf

botdraw()
Next

EndFunction


Function botdraw()

bot(ind).image=1000+ind
CreateFXImage bot(ind).image,bot(ind).imx,bot(ind).imy
RenderToImage bot(ind).image

DrawRotatedImage part.leg,bot(ind).pos1.x,bot(ind).pos1.y,180,1,1,-10,0,1;5=10/2
Login required to view complete source code




Big C.

boaarr stef, I'm very impressed... great job... What a game Idea will be behind this demos...

Ian Price

LOL. Glug glug! :D

Any chance of these appearing in a game?
I came. I saw. I played some Nintendo.

stef

Hi!

QuoteAny chance of these appearing in a game?

Hm?! Why not? :)

What about "Underwater robot soccer"?

or "Under-the-beach-volleyball"?

stef

#13
Hi!

This is the "wheeler"-type-animation sketch.
(the "walker" isn't still ready)

You must click with left mouse button (above,below,left or right of the beetle.

This prog is a sketch to demostrate some principals. (the routines are not really useful that way)

Greetings
stef

PlayBASIC Code: [Select]
; PROJECT : bots3
; AUTHOR : stef
; CREATED : 09.07.2006
; EDITED : 14.07.2006
; ---------------------------------------------------------------------



;made with PB V1.44

Global sw=800
Global sh=600

;OpenScreen sw,sh,32,2
;ScreenVsync On
SetFPS 50

Global grey30= RGB(30,30,30)
Global grey60= RGB(60,60,60)
Global grey90= RGB(90,90,90)
Global grey120= RGB(120,120,120)

Global bs=50
Global lh=400;levelheight
Global factor=1

Global mousestatus
Global mx,my
Global status
global speed
Global a1=1
global legangle#
global f#,f2#,zoom#=0

Global number=0;bots= number+1

Global backgroundim

Type theadcol
col
EndType

Type thead
headcol As theadcol
EndType

Dim head(5) As thead

Dim leg(100)


Type tparts
leg
joint
foot
wheel
bigwheel
EndType

Dim part As tparts



Type position
x#,y#
EndType

Type tbots
masterstatus
masterpos As position
masterangle#
image
sp
legangle
factor
imw,imh,center_x,center_y

pos01 As position
pos02 As position
pos03 As position
height
EndType


Dim bot(number) As tbots


background()
partsdrawing()

Global ind

For ind= 0 To number
bot(ind).imw=3*bs
bot(ind).imh=3*bs
bot(ind).center_x=bot(ind).imw/2
bot(ind).center_y=bot(ind).imh/2

; y: -8, +3 , +8
bot(ind).pos01.x=bot(ind).center_x+10
bot(ind).pos01.y=bot(ind).center_y-6
bot(ind).pos02.x=bot(ind).center_x
bot(ind).pos02.y=bot(ind).center_y-6
bot(ind).pos03.x=bot(ind).center_x-10
bot(ind).pos03.y=bot(ind).center_y-6
bot(ind).factor=1

pos1y=3
pos2y=8
pos3y=20


bot(ind).masterpos.x=bot(ind).masterpos.x+400
bot(ind).masterpos.y=lh;+bs/2
Next
;----------------------------------------------------------------loop
Do

statuscalc()


RenderToScreen
Cls 0

DrawImage backgroundim,0,0,0

DrawAllSprites

Sync

DeleteALLSprites
Loop
WaitKey
;----------------------------------------------------------------------

Function statuscalc()


For ind = 0 To number


If MouseButton()
mx= MouseX()
my= MouseY()
r=bot(ind).masterpos.x+25
l=bot(ind).masterpos.x-25

If mx> r Then mousestatus=10

Login required to view complete source code

Ian Price

LOL :D

That is excellent. And that bug is sooo darned cute too.
I came. I saw. I played some Nintendo.