Quite a fewpeoplehereand I don't oftenstreamonYouTube.
I tendtostreamontwitch.
Twitchis a littlebitmoreaccessibleforstreaming.
Right.
Sowe'vegot a basicpixelgameengineapplicationappear I'm using 6 40 by 4 80 resolutiononmypixeltoscreenratioisgoingtobetooon.
Allitdoesiscreateanemptywindow.
Now, ifwe'regoingtocreate a shootingup, I thinkthefirstthingwe'regoingtoneedis a shipso I willbegonesoon.
Occasionallymyprototype.
But I justwanttomakesure I getthevariablenamesthat I comeupwithconsistentinthefirstplace S o fortheship.
All I reallycareaboutiswheretheplayerspositionis s o.
I'm goingtouse a O l f l c vectorfloatingpointtoDIYtype.
And I usedthesequite a lot.
Nowonit.
CallAuntVI.
Playit.
Paul's verysimplestuffon.
I'm goingtoneed a spritetodrawwhattheplayershiplookslike.
It's gonnamovemymicrophoneslightly.
Sodoletmeknowifit's a problemonbridges, and I willseespringtypehere.
CreateappointedtoSP R Playernowbecause I'm doingthisliveand I wanttoknowquite a bittogetthroughtonight I willbecuttingsomecornersregardinginitializingvariablesanddeletingthings.
So I wanttoadjustthewine, coordinate, playspeedNow, wheneverwe'redoingmovement.
Andifyouwatchthechannelongatheringthepeoplethatareheretonightornot, brandnewtothechannel, soyou'llknowthatweuse f elapsedtimeThiomodulatethemovementacrossthescreen.
And I'm goingtocreateanarrayofstarsandveryunusuallybecausepeopleshoutedmenowfornotusingmodern.
See, I'm goingtousestandardarrayonallofmystarsarealsogoingtobe a two D coordinateson I'm goingtohave I don't know 100 stars.
Maybewe'llsee.
Let's callthat a Raystarsondhe.
I'm goingtoinitializethisjustwithrandomcoordinates, forthemostpart, because I don't knowwheremystarsaregoingtobe, so I'lldothisinitializationinonusercreates.
Let's dothat.
Itcoulduse a littleautoforLuke, uh, throughmyarrayofstars.
So I'm goingtowanttospeedatwhichtheuniverseismovingleftworldspeedondhe.
I'lljustpick a numberfornow.
20.
Andso I wantallofmystarstoscrolldownwordsbythatspeedbeforetheygetdropped.
So I couldjustdoitlikethis.
All I wanttodoisalterthe y coordinatebecauseofthe X coordinatecanstayinthesameplace s Soif I dothatby F Worldspeedtimes a fewlapstimesthatwillupdatethewhitecordofthestar.
Soifthestarhasgoneoffthebottomofthescreen, sojustcheckbycomparingittoscreenheights, andwe'reprobablygoingtoneedsomecastinginit, thenwe'llreadwillchoose a new X valueforthestar.
I'm justgoingtoborrowthislineofcodeofpicks.
We'vealreadygotitchoosingyou X valueforthestar.
But I'm goingtosettheheighttobezerodoublecheck.
Yeah, notlooksensible.
Let's have a look.
Soallofmystarstartscrollingdown, andwhentheyfalloffthebottom, theyget a new X coordinate.
Sothe 1st 100 stars, I wantthemtomoveslightlyslowerthantheremaining 100 stars.
OK, gettingthere s oh, it's just a bias.
Ourspeedherebythe I value.
Soifour I islessthan, let's say, the 1st 100 stars.
Ifthat's true, then I wanttomovethose a littlebitslowerthanalloftheothers, which I canmakesbasicallyslowingitdownbecause I'm notapplyingitby a numberlessthanone.
Soif I'm notslowingitdown, I wantthemtowillbetheactualspeedwespecifiedbefore.
Solet's justseehowwelldoesthatwork?
Well, there's certainlysortof a deathcharacteristicthere.
Maybenotenoughstars.
Maybeyouwanttochangethat 200 step, I'llsay 300.
Let's beoptimistic.
Sothat, tomethat's a littlebitmoredepthtowhat's goingupmightalsohelptoshadethestars a slightlydifferentcolor, too.
Sobasedonthesameequation, I'm goingtochoose a differentcolor.
Soifthey'retheonesthataremovingslower, then I'm goingtousewell, seegray, sothey're a bitfurtheraway.
They'renotquite a brightwell, somethingtouse.
Well, see, WhiteCapitalLLC.
Oh, well, seewhite.
Thetake a quicklook.
That's a bitbettertomyeyes, atleastonmyscreen, thatlooks a littlebitmoredistinctive.
right.
Sowe'venowgot a shipflowingthroughspaceflyingflowingthroughspace, andwe'vegotsomethinginthebackgroundthatsuggeststhatwe'removing.
I don't thinkHowwouldwenormallygoaboutsettingsomethinglikethissowell?
Usuallywhen I writegames, nearlyallofthevideos I'vedonesofareverythingtendstobetilebased.
Soyouperhapshave a hugeworld, andyou'd allocate a specifictiletobetheenemy.
Andbecausewe'removingthroughtheworldthantheenemiesdon't reallymove, they'lljustpropagatetowardstheplacethathaving a tilebasedsystemisprobablygoingtobetoorestrictive.
Soweknowwe'vegotdifferenttypesofmovementthatwerequire, and I don't wanttobeupdatingallofthesemovementcharacteristicsforeverysingleobjectbecausemostofthetimewe'renevergoingtoseethem.
It's a wasteofprocessingresourcesonGivethemthat.
I suspectwhatwe'regoingtoreallywantismillionsandmillionsandmillionsofbullets.
Physicsmaystarttobecome a resourcethatweneedtolookafterbecausewedon't justwanttheenemy's firingin a boringstraightline.
Wewantthemfiringinallsortsofcrazy, interestingpatents, sospiral E bullets, pulsesofringsofbulletsthatcomeoutatsomewaytomakethechallengefortheplay.
OntheideaisbeingWedon't have a bigqueueoffdifferentenemies, sothesearegoingtobecueduponeat a time, andtheyalldon't have a startingtriggertimeongoingtobeinorder, ofcourse, andthatmeanswhenourworldtimecallon W.
Therethewillhave a differentstructurecalledenemy, whichistheonscreenentitydoingitsthing, anditwillbedefinedbywhatisinthisenemydefinition.
Sowesaidthatweknowthattheenemy's airgoingtohappenat a certainpointintime.
Sothefirstthing a labis a variablethatisourtriggertime.
I'lljustsetdefaultthattozero.
Sowhenworldtimecatchesupwiththetriggertime, we'regoingtoconvertthisenemydefinitionintoanenemythattheenemydefinitionneedstotelluswhatthespitelookslike s so I'm goingtouseuse a U.
N.
32 forthis.
I'veonlygotthreespritesforthisparticularvideo, butthat's goingtobeourSprite I D, whichnowisprobably a goodtimetoactuallyloadthoseSprite.
So I'llcreate a smallerrayoffspritesdespitestarthatisSP R enemyon.
Wewantthreeofthem.
Let's godownhereonloadthose.
We'lljustdosomeverticalcurse a ringenemyone 12 andthreeonthe's arealsogoingtobe a Spriteenemy.
Well, don't startcountingitwall.
Therewego.
Theydon't wantto.
Sowe'vegotnowthreeenemyspritesloadedinon.
We'regoingtorepresenteachofthosespikedwiththis.
Identifythisendspite I d ofthethingsthatourenemymighthaveissomehealth.
Andi, ifyougetkilled, well, we'reprobablynotgonnagetusfarasimplementingdeathButwe'llsee s soforeachtypeofenemythat's comingintothegame, I wanttopopulatethis s enemydefinitionstructure.
So I canseeherethatthefirstelementsthatwe'regoingtoaddishowlongbefore?
And I hadtodosomeexperimentsonthis.
So I'm justgoingtograbsomenumbers, sowe'renottoobusylookingaroundlater.
Well, thisisthebitthat I wantedtobekindofextensiblebecause I thinkwouldbefunforthecommunitytotakesomeofthiscodeandgoawayandcreatethemostextremeandcrazy, futilegamesyoucanthinkoff.
And I'm goingtousethatsomethingwhichis a littleunusual, perhapsonourchannel.
Sothat's whywe'vegotthis a littleupdatefunctioninhere.
I'm goingtoinsteadofjusthaving a bigswitchcasestatementinthisupdate, I'm goingtoallowustobasicallylinkin a functionthatdescribesthemovementdirectlyintotheenemyeso.
Inmyenemydefinition, I'm goingtoadd a standardfunctionpointeronthetypeisgoingtobe.
It's goingtoreturn.
Voiddoesn't needtoreturnanythingatall, butit's goingtotakein a referencetotheenemyitself.
Nowwejustneedtoforwarddeclarethatenemyappearandtomakeyouintaking a referencetotheenemythat's currentlybeingupdatedondhe.
I'm goingtopassinsomeadditionalparameters.
I justwannamakesure I gettheorderconsistentwithwhattheseparametersare.
Right.
Sothey'regoingtobethe F collapsetime, becausethat's whatweneededdownbelow.
And I'm alsogoingtopassinthecurrentworldspeedthatworthweremovingaroundat.
I'm goingtocallthatscrollspeed.
I'm doingthiswrong.
Afterthat, thingsarejustgoingtobefloat.
Sowe'vegotthesetwofloatsWaitthatsomeone's passing a lambdafunctionthatrepresentsthisparticularmovementtype.
I'm goingtocallthatfunkmove.
Notthatitmovesin a funkywayjustyet.
Onwhenwebookeddatetotheenemy's position.
All I needtodoiscallthatthedefinitionthatwe'veassociatedwiththatenemyandcallthefunkmovefunctionthatweassociatewithit, inwhichcaseit's goingtobetheenemyon.
Thenit's goingtobetheelapsedtimethatwe'vepassedinhere, and I alsoneedtoknowthescrollspeedbecausetheworldisscrollingat a speedthatwe'vechosen.
So I thinkit's importantthatwehavejustbasicallygowiththeflow, traveldownthescreensthatwillbemovementnone, andbasically, it's justgoingtomovein a straightlinedownconfusing.