Pokemon

Show off your games, demos and other (playable) creations.
User avatar
jradich
Party member
Posts: 100
Joined: Mon Dec 12, 2011 8:44 pm

Pokemon

Post by jradich » Fri May 11, 2012 2:19 am

Ok so what I decided to make was a very simple version of the Pokemon battle system. There's no AI at the moment, and there is certainly a lot to be implemented, but I think it's a good start. Enjoy!
And excuse inappropriate names.
Last edited by jradich on Fri May 11, 2012 11:05 am, edited 1 time in total.
Losing a friend's trust is the fastest way to lose a friend, forever. FOREVER!

User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Pokemon

Post by Roland_Yonaba » Fri May 11, 2012 9:22 am

This is definitely not a good start.
I looked at it, and found many code repetitions. That is not how classes work.
Besides, you are using a fairly simple class system.Then take full advantage of it.

Note that yours classes (Twattle and Vagikarp) have exactly the same methods, but you repeated them. I expect when you'll next have to add new species, you will rewrite down the same stuff, and it will result in a extremely long source code.

Why not move all methods (draw, fight, level up, faint) into the basePoke class ? And then instanciate Vagikarp and Twattle ?

Code: Select all

class "BasePoke" {
	hp=100, name="Base",user=true,enemy=false,level=1,attacking=false,attackname='fap'
}
function BasePoke:__init(hp,name,user,enemy,level,attacking,attackname)--Sets how you would name a custom pokemon
  --etc
end


function BasePoke:draw()
  --etc
end
function BasePoke:fight()
  --etc
end

function BasePoke:levelup()
  --etc
end

function BasePoke:faint()
  --etc
end

Vagikarp=BasePoke:new(100,"Vagikarp",true,false,1,false,'fap')
Twattle=BasePoke:new(100,"Twattle",false,true,1,false,'fap')
And that's it. Then you should be able to use Twattle:draw(), Vagikarp:levelup(), etc...the same way than before.
Don't forget to consider that inside methods, you can call other methods, just use self.
Example:

Code: Select all

function BasePoke:fight()
	if fight==true then
        --etc etc
	end
	self:levelup()
	--etc etc
end

User avatar
jradich
Party member
Posts: 100
Joined: Mon Dec 12, 2011 8:44 pm

Re: Pokemon

Post by jradich » Fri May 11, 2012 10:55 am

Roland_Yonaba wrote:This is definitely not a good start.
I looked at it, and found many code repetitions. That is not how classes work.
Besides, you are using a fairly simple class system.Then take full advantage of it.

Note that yours classes (Twattle and Vagikarp) have exactly the same methods, but you repeated them. I expect when you'll next have to add new species, you will rewrite down the same stuff, and it will result in a extremely long source code.

Why not move all methods (draw, fight, level up, faint) into the basePoke class ? And then instanciate Vagikarp and Twattle ?

Code: Select all

class "BasePoke" {
	hp=100, name="Base",user=true,enemy=false,level=1,attacking=false,attackname='fap'
}
function BasePoke:__init(hp,name,user,enemy,level,attacking,attackname)--Sets how you would name a custom pokemon
  --etc
end


function BasePoke:draw()
  --etc
end
function BasePoke:fight()
  --etc
end

function BasePoke:levelup()
  --etc
end

function BasePoke:faint()
  --etc
end

Vagikarp=BasePoke:new(100,"Vagikarp",true,false,1,false,'fap')
Twattle=BasePoke:new(100,"Twattle",false,true,1,false,'fap')
And that's it. Then you should be able to use Twattle:draw(), Vagikarp:levelup(), etc...the same way than before.
Don't forget to consider that inside methods, you can call other methods, just use self.
Example:

Code: Select all

function BasePoke:fight()
	if fight==true then
        --etc etc
	end
	self:levelup()
	--etc etc
end
Thanks
Changed it.
love pokemon.love
(2.5 KiB) Downloaded 260 times
Losing a friend's trust is the fastest way to lose a friend, forever. FOREVER!

User avatar
rokit boy
Party member
Posts: 198
Joined: Wed Jan 18, 2012 7:40 pm

Re: Pokemon

Post by rokit boy » Sat May 12, 2012 12:41 am

jradich wrote:
Roland_Yonaba wrote:This is definitely not a good start.
I looked at it, and found many code repetitions. That is not how classes work.
Besides, you are using a fairly simple class system.Then take full advantage of it.

Note that yours classes (Twattle and Vagikarp) have exactly the same methods, but you repeated them. I expect when you'll next have to add new species, you will rewrite down the same stuff, and it will result in a extremely long source code.

Why not move all methods (draw, fight, level up, faint) into the basePoke class ? And then instanciate Vagikarp and Twattle ?

Code: Select all

class "BasePoke" {
	hp=100, name="Base",user=true,enemy=false,level=1,attacking=false,attackname='fap'
}
function BasePoke:__init(hp,name,user,enemy,level,attacking,attackname)--Sets how you would name a custom pokemon
  --etc
end


function BasePoke:draw()
  --etc
end
function BasePoke:fight()
  --etc
end

function BasePoke:levelup()
  --etc
end

function BasePoke:faint()
  --etc
end

Vagikarp=BasePoke:new(100,"Vagikarp",true,false,1,false,'fap')
Twattle=BasePoke:new(100,"Twattle",false,true,1,false,'fap')
And that's it. Then you should be able to use Twattle:draw(), Vagikarp:levelup(), etc...the same way than before.
Don't forget to consider that inside methods, you can call other methods, just use self.
Example:

Code: Select all

function BasePoke:fight()
	if fight==true then
        --etc etc
	end
	self:levelup()
	--etc etc
end
Thanks
Changed it.
love pokemon.love
addthat to SYS post.
u wot m8

User avatar
jradich
Party member
Posts: 100
Joined: Mon Dec 12, 2011 8:44 pm

Re: Pokemon

Post by jradich » Sat May 12, 2012 12:45 am

rokit boy wrote: addthat to SYS post.
Already did.
Losing a friend's trust is the fastest way to lose a friend, forever. FOREVER!

misstr87
Prole
Posts: 1
Joined: Mon May 14, 2012 11:46 am

Re: Pokemon

Post by misstr87 » Mon May 14, 2012 11:52 am

Some good basic advice there for beginners.
Thanks.

And hope the pokemon project continues :megagrin:

User avatar
jradich
Party member
Posts: 100
Joined: Mon Dec 12, 2011 8:44 pm

Re: Pokemon

Post by jradich » Wed May 16, 2012 2:00 am

love pokemon.zip
(4.78 KiB) Downloaded 127 times
New Update. Pictures are now possible, and there are multiple attacks.
Losing a friend's trust is the fastest way to lose a friend, forever. FOREVER!

User avatar
Roland_Yonaba
Inner party member
Posts: 1563
Joined: Tue Jun 21, 2011 6:08 pm
Location: Ouagadougou (Burkina Faso)
Contact:

Re: Pokemon

Post by Roland_Yonaba » Wed May 16, 2012 9:12 am

I haven't run it yet, I just took a look at the code. Looks nicer than before.

User avatar
jradich
Party member
Posts: 100
Joined: Mon Dec 12, 2011 8:44 pm

Re: Pokemon

Post by jradich » Wed May 16, 2012 11:44 pm

Roland_Yonaba wrote:I haven't run it yet, I just took a look at the code. Looks nicer than before.
Thanks.
Oh and also, making pokemon is incredibly easy. Just write:

Code: Select all

YourPoke=BasePoke:new(hp,name,user,enemy,level,attackname1,attackname2,pic)

And call "YourPoke:fight()" and "YourPoke:draw()" in the proper functions. Remember, though, there are only two attacks, though new attacks are easy, too.
Losing a friend's trust is the fastest way to lose a friend, forever. FOREVER!

User avatar
jradich
Party member
Posts: 100
Joined: Mon Dec 12, 2011 8:44 pm

Re: Pokemon

Post by jradich » Mon May 21, 2012 11:40 pm

love pokemon.love
(20.17 KiB) Downloaded 239 times
Shameless bump, because of progress.
Losing a friend's trust is the fastest way to lose a friend, forever. FOREVER!

Post Reply

Who is online

Users browsing this forum: MadByte and 5 guests