►
From YouTube: NEAR Certified Demo | Episode 3.4 -- Pokemon
Description
This demonstration was presented by the author(s) after just 1 week of working with the NEAR platform as part of the NEAR Certified Developer program.
You can find the source code to this demo here:
https://github.com/Learn-NEAR/NCD-03--pokemon
---
Follow the latest from NEAR Protocol on:
Website: https://near.org/
Discord: https://near.chat/
Blog: https://near.org/blog/
Twitter: https://twitter.com/NEARProtocol
GitHub: https://github.com/near https://github.com/nearprotocol
#Blockchain #FutureIsNEAR #NEAR #nearprotocol
A
B
I
did
was
very
similar
to
what
danny
and
the
mons
group
did
is.
I
did
mine
actually
with
pokemon.
I
didn't
make
any
new
creatures,
but
it's
a
very
similar
setup.
Let
me
just
start
with
the
models.
Let's
just
start
with,
the
data
can.
B
Okay,
cool
yeah,
so
same
setup.
You
got
the
the
pokemon
id
list
class
because
you
need
to
serialize
it,
so
you
set
that
up
just
to
keep
the
array
of
strings
for
the
each
pokemon
they
have
an
owner
and
then
there's
all
these
base.
Health
attack
defense,
speed
fields
which
makes
each
pokemon
unique,
and
you
know
the
higher
these
fields-
are
the
more
valuable
and
stronger
the
pokemon
is
and
there's
other
stuff
like
current
health
experience.
B
That's
for
that
stuff,
that's
updated
throughout
the
whole
lifetime
of
the
pokemon
and
then
base
experience
yield
it's
just
64
for
all
of
them.
That's
just
another
thing.
If
I
was
to
actually
go
into
this
and
each
the
pokemon
would
have
different
ones
for
that,
but
basically,
when
you
instantiate
the
pokemon,
it
gives
you
a
random
base
value
for
each
of
these
to
make
each
of
them
unique.
B
Various
methods
in
here
there's
this
gain
experience
method.
There's
also.
I
made
this
serialized
pokemon
class,
which
is
what
I,
which
is
what
we
use,
which
is
what
is
returned
when
we're
doing
any
of
our
view
functions.
We
return
this
because
want
to
get
more
data,
and
then
these
are
the
maps
and
the
owners
and
then
for
the
actual
functions.
It's
I
got.
You
know
your
basic
create
one.
B
You
can
just
give
it
a
nickname
and
it'll
give
you
a
random
pokemon,
it's
only
whatever
bulbasaur,
charmander
and
squirtle
for
right
now.
So
we'll
give
you
a
random
one
with
the
nickname
you
delete
a
pokemon
by
id,
but
only
you
know,
the
owner
of
the
actual
pokemon
can
delete
similar
to
transfer.
You
can
transfer
to
a
new
one,
but
only
the
owner
can
transfer.
B
It
also
have
this
heal,
pokemon
and
train
pokemon
thing
healing
just
sets
their
the
pokemon's
health
back
to
back
to
their
full
health
and
then
the
training
is
you
specify
id
pokemon?
You
want
to
train,
you
specify
the
cpu
level
and
I
just
went
online
and
found
like
the
basic
formulas
involved
in
the
damage
calculation
for
pokemon.
B
So
I
just
added
that
in
here
you
know
whoever
whatever
pokemon
is
faster
goes
first
and
then
you
it's
a
pretty
simple,
whatever
it's
pretty
simple
formula
to
calculate
damage,
so
those
are
the
five
essential
change
functions
and
then,
for
the
view
functions
it's
get
pokemon
by
owner.
B
So
if
you
want,
you
know,
get
all
the
pokemon
for
a
specific
owner.
If
you
want
to
get
a
pokemon
buy
a
specific
id
or
if
you
just
want
to
get
all
pokemon
also
got
some
unit
tests
in
here
continue
talking
to
for
notifications,
sake,
so
yeah
unit
test
and
then
a
bunch
of
various
helper
functions.
Everything
from
the
random
numbers
to
just
you
know,
adding
a
pokemon
removing
a
pokemon
from
an
owner.
B
So
I
can
just
show,
let's
see
oh
man,
this
thing's
on
the
bottom
of
my
screen,
whatever
okay,
so
I
am
going
to.
I
just
ran
the
get
all
pokemon
function
right
now.
I
already
have
a
pokemon
in
there
it's
level
six,
because
I've
been
training
it.
B
So
if
I
wanted
to
create
a
new
one,
I
just
do
near
call
contracts
create
pokemon.
Let's
see,
I'm
just
gonna.
Do
nickname,
let's
just
call
it
near.
B
Let's
see
here,
okay
and
then
they
should
make
a
new
one.
Okay
and
then
just
excuse
me
just
create
a
squirtle
that
rhythm.testnet
is
not
the
owner
of
and
say
I
want
to
train
that
skirt
squirtle.
What
I
could
do
is
same
thing
that
I
you
know
just
wrote:
train
pokemon.
B
You
know
you
just
specify
the
id
of
the
pokemon
and
then
you
get
to
also
specify
the
level
the
cpu,
because
the
higher
level,
the
cpu,
the
more
experience
you
get.
Let
me
make
sure
I
got
the
the
ddd
casing,
correcting
that
cpu
level
cpu
level
yeah,
so
I'm
gonna
go
versus
the
four.
So
I'm
feeling
bold,
oh,
it
starts
at
level
five
by
the
way,
but
still
and
then
there's
obviously
stuff
like
I
haven't
added
any
typing
with
anything
that
looks
good.
I
think
yes
yeah.
B
I
haven't
added
any
cool
user,
one
with
10
hp
left.
I
have
an
ad,
I
haven't
added
any
typing
or
any
specific
moves.
It's
just
all
the
pokemon
do
the
same
damage
with
their
move.
It
depends
on
you
know
their
level
and
the
skills
involved
with
that,
but
yeah.
I
think
that
covers
it.
Let
me
see,
I
think.
A
You're
at
about
six
minutes:
okay,
if,
if
you
want
to
wrap
with
maybe
a
30
seconds
or
a
minute
of.
B
Yeah,
this
was
a
lot
of
fun
this.
My
first
this
week
was
my
first
foray
in
the
blockchain
ever
so
it's
you
know,
awesome
technology,
I'm
super
glad.
I
did
this
and
then,
as
for
some
like
stuff
I
was
dealing
with
with
developing.
Is
I
don't
know
if
it
was
my
ts?
B
Config
wasn't
set
up
correctly
or
the
assembly
script,
I'm
using
isn't
up
to
date
or
something,
but
I
was
trying
to
do
like
interfaces
and
types,
and
I
was
trying
to
do
sometimes
like
you
know
I
wanted
to
do
serialized,
pokemon
or
undefined
or
something
you
would
freak
out
about
that.
B
Yeah,
so
it's
just
you
know
my
first
inclination
from
the
for
one
for
some
of
these
variables,
like
oh
I'll,
make
this
a
type
well,
you
know
turns
out
you
can't
do
that.
Just
you
know
just
a
lot
of
classes
but
yeah,
it's
very
fun.