Jump to content

Anarchy805 Development (CLUB)


Anarchy805

Recommended Posts

  • Replies 83
  • Created
  • Last Reply

I did start making some code for a TCG but I left it on the back burner while i carried on with some other projects. what parts are you having trouble with maybe we can help if you outline what parts you already have and what parts you need. it is best to follow a production / development cycle when you have an idea of a game that you want to develop. you can read the Anarchy 805 Development best practices for the development cycle if you need to refresh or gain extra ideas on how to structure your Game Development.

Link to comment
Share on other sites

well i have started by trying to make a deck

 

tdeck = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40]

 

with a deck of 40 cards indexed from 0 to 39 in an array the first problem i came across was how to shuffle them so i need perhaps a random number sort or something i think, but i am not too sure how to impliment it in RPG Maker. can anyone help?

Link to comment
Share on other sites

Welcome to the club .Jingles your in with VIP status.

 

fighteronspeed:

 

it is a good idea to start with the deck, but you may have to write a search method as an override to the Array class.

You can do this by adding a new script to the list of scripts above main called array and then add a method override to the array class using standard ruby mark-up in there.

And yes you can do a random sort function for the shuffle but remember to make 2 functions to make things simpler like one called Shuffle and one maybe Shuffle! you should be able to use a simple syntax to add the method then you can call it like

tdeck.shuffle

or

tdeck.shuffle!

or whatever you end up calling your method.

 

Try that to start with and let me know how it goes.

Link to comment
Share on other sites

Thanks Anarchy805 but I have no idea where to start with writing class override remember i only started ruby about a week ago so i kind am a little new to the syntax i tried doing something like in python but i am not to sure where to start in translating it to ruby. could you help me write an override please?

 

 

oh and Welcome to the club .Jingles

Link to comment
Share on other sites

fighteronspeed:

OK I will write you an Array class override this time but next time post your code you have done so far so we can see if there is a way to show you how to translate more code in the future. here is what i would use to do it and when you make your array probably best to initialize it with an array.new i will give an example of that too.

class Array
 def shuffle
   sort_by { rand }
 end

 def shuffle!
   self.replace shuffle
 end

end

 

that was a simple shuffle function also for a deck you will proberbly want to use shuffle! i will give an example below

 


$deck1 = Array.new
$deck1[0..39] = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30

$deck1.shuffle!

print $deck1[0]

now that is an example of initializing your deck array and then adding 40 cards to it.

it is a prety simple example but i think you should get the picture and be able to modify it to suit your needs.

 

 

anything else you need just post your code in a set of code tags and point out what you need help with.

Link to comment
Share on other sites

.Jingles:

At the moment we are helping fighteronspeed with his programming, he is having a go at starting a TCG Like Duel Monsters(Yugioh). and he was having a little difficulty with shuffling the deck so a wrote a class override to shuffle for him.

 

I am currently on a few projects so not exactly making a game at the moment, I am making updates to the "DragonSocketAPP" and POSIX Communication Services Security Applications at present but i will be continuing development on a TCG of my own when i get the other stuff out of the way. I might end up posting some Tutorials on simple logic AI for games and a few other fragments of code.

 

Also i think we might do a Competition to make a design for fighteronspeeds card game cards so that the cards can then be unique.

Link to comment
Share on other sites

fighteronspeed:

OK well sorry I just noticed the question above Neries's Post too. well you can push and pop it will deal from the bottom of the deck tho in the situation where you are using it you may want shift and unshift instead it will deal from the top of the pile.

And yes you just need to make an array be a part of the array like this:

$deck1 = Array.new # initialize the array
$hand1 = Array.new # initialize a hand array
$deck1 << [1,'nameofacard', 'typeofcard'] # add an array inside it
$deck1 << [2,'nameofnextcard','othertypeofcard'] # add another one

$deck1.inspect # inspect it this will show you its contents

$hand1[0] = $deck.shift # draw a card using shift to put it in to the hand array

$deck1.inspect # inspect the deck to see now only 1 of the cards are there
$hand1.inspect # inspect the hand and it will have the shifted item

 

that sample is a little rough but it serves the purpose of showing you how to shift data from deck to hand and hoew to add arrays or hashes to an array to nest it.

Link to comment
Share on other sites

OK i made this code but it is giving errors what is wrong with it?

$Deck = Array.new
$Hand = Array.new
$Field = Array.new
$Grave = Array.new


$Deck << ['Cyber Dragon1','5','Machine','2100','1600']
$Deck << ['Cyber Dragon2','5','Machine','2100','1600']
$Deck << ['Cyber Dragon3','5','Machine','2100','1600']
$Deck << ['Cyber Dragon4','5','Machine','2100','1600']
$Deck << ['Cyber Dragon5','5','Machine','2100','1600']
$Deck << ['Cyber Dragon6','5','Machine','2100','1600']
$Deck << ['Cyber Dragon7','5','Machine','2100','1600']
$Deck << ['Cyber Dragon8','5','Machine','2100','1600']
$Deck << ['Cyber Dragon9','5','Machine','2100','1600']
$Deck << ['Cyber Dragon10','5','Machine','2100','1600']

$Deck.shuffle!


$Hand << $Deck.shift
$Hand << $Deck.shift
$Hand << $Deck.shift
$Hand << $Deck.shift
$Hand << $Deck.shift

print $Hand

also i have made arrays for hand deck grave field are there any others that i need to make?

Link to comment
Share on other sites

Are you making a yugioh card game if so missed spell, monster card zonez the extra deck and out of play but if not you should be making some rules before you even think of making a field so like I said before I will help with stuff I just need something to work with that's from your creativity.

 

Here is that sword I did but with the boarders done.

 

The_finished_sword_by_NeriesUmbra.png

Link to comment
Share on other sites

fighteronspeed: the problem as i see it is that you have made all of your Array's Global Constants.

in ruby you denote a constant by Capitalizing the first letter of the word. i see no real problem with your code other than it not having any comments and a little messy optimization wise. Might i suggest you de-capitalize the first letters of your keywords(variables) as this should then make your code run error free. unless you have errors in code that you may not have posted. also to add to what NeriesUmbra said we should be better equipped to help if you set out a plan, perhaps re read the preferred development path of Anarchy805 Development (CLUB) on the top of the front page. and make a simple top down or bottom up design of what it is that your goal actually entails.

Link to comment
Share on other sites

Thanks again guys it is working great now. i added a few arrays and got my cards drawing and shuffling I have read a few bits from the ruby books and re read your guidelines and decided to start a plan but it looks like this project will be quite big. so I might start on something a little smaller, but i will get on to making a top down design of the actual game and try to get a mock up done in photo-shop then put it to you guys for a brainstorming session to see if i have missed anything.

Thanks again for all your help.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...