Friday, August 12, 2011

[Rails] Re: Building a Browser Game: write a method for counting the "points" - using this method in links

The buildings got a "lvl" the lvl is the same like their id in their
table( a little useless maybe ^^'). So I want to write an upgrade
action. This should be like this:
On the Village show page, the buildings of the Village are listed. You
can click on a link or button to "upgrade" one Building. The code
checks if u have enough resources, if its not the "max - lvl" , the
tests pass:
Village.building_id should get + 1 . To get the building with the
higher lvl.
Village.save

I don't touch the building table, it's all in the village.

For example
The code does this:
Village.pit_id = Village.pit_id + 1

( <Pit id: 1, lvl: 1, points: 5, rate: 12, created_at: "2011-08-11
13:51:11", updated_at: "2011-08-11 13:51:11"> to
<Pit id: 2, lvl: 2, points: 12, rate: 18, created_at: "2011-08-11
13:51:11", updated_at: "2011-08-11 13:51:11">

i hope you can figure out what i mean...

On 12 Aug., 07:49, 7stud -- <li...@ruby-forum.com> wrote:
> When do you want to update a Building?
>
> --
> Posted viahttp://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate