gembots 0.1.2 → 0.1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +32 -0
- data/Rakefile +8 -0
- data/gembots.gemspec +23 -0
- data/lib/gembots.rb +6 -0
- data/lib/gembots/bot.rb +2 -2
- data/lib/gembots/projectile.rb +32 -0
- data/media/cannon.png +0 -0
- data/media/projectile.png +0 -0
- data/media/tank.png +0 -0
- metadata +12 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f10a6144686e6a0480a0a4de23bc4a444e4eb28
|
4
|
+
data.tar.gz: c09bffbd894587c59b3aed0be57066e3aa1101bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 256e4ef85339ae1a72a4556edc11d1de69dac327b463cfac2d3e303f1234a6f9b33d45e7f5cb79c079d62a222136933b56c1d34e0beb775f8836a0dacef92885
|
7
|
+
data.tar.gz: 43138da1dc9ec3b0d2d063718356c82b0b58116834109b345009d80b01176dcb32fe92c5c30e01173ce7dd22e6a06ae3e0a3804878ab4340ed9d09c636a340f5
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 L8D
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Gembots [![Gem Version](https://badge.fury.io/rb/gembots.png)](http://badge.fury.io/rb/gembots)
|
2
|
+
|
3
|
+
Gembots is a ruby library for creating your own battle bot in ruby. This is almost exclusively based on [FightCodeGame](http://fightcodegame.com), but it uses libgosu for the arena, and of course, it's in ruby. Currently it is in EXTREMELY early development.
|
4
|
+
|
5
|
+
If you want to see a good example, just `bundle` and then `rake`.
|
6
|
+
View the test code to see what's behind it.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
gem 'gembots'
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install gembots
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
TODO: Write usage instructions here
|
25
|
+
|
26
|
+
## Contributing
|
27
|
+
|
28
|
+
1. Fork it
|
29
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
30
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
31
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
32
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/gembots.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "gembots"
|
7
|
+
spec.version = '0.1.2.1'
|
8
|
+
spec.authors = ["L8D"]
|
9
|
+
spec.email = ["tenorbiel@gmail.com"]
|
10
|
+
spec.description = %q{Library for creating Gembots}
|
11
|
+
spec.summary = %q{Create your own gembots and battle them in a cli arena}
|
12
|
+
spec.homepage = "http://github.com/L8D/gembots"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "gosu"
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
data/lib/gembots.rb
ADDED
data/lib/gembots/bot.rb
CHANGED
@@ -17,8 +17,8 @@ class Gembots::Robot
|
|
17
17
|
@warped = false
|
18
18
|
@actions = []
|
19
19
|
@window = window
|
20
|
-
@images = Gosu::Image::load_tiles(window, "
|
21
|
-
@image = Gosu::Image.new window, "
|
20
|
+
@images = Gosu::Image::load_tiles(window, "#{Gembots::MEDIA}/tank.png", 32, 32, false)
|
21
|
+
@image = Gosu::Image.new window, "#{Gembots::MEDIA}/cannon.png", false
|
22
22
|
@x = @y = @angle = @cur_image = 0.0
|
23
23
|
end
|
24
24
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'gembots'
|
2
|
+
|
3
|
+
# Class used by the arena to represent a projectile(bullet).
|
4
|
+
class Gembots::Projectile
|
5
|
+
# Positions of the projectile.
|
6
|
+
attr_reader :x, :y
|
7
|
+
|
8
|
+
# Angle of the projectile.
|
9
|
+
attr_reader :angle
|
10
|
+
|
11
|
+
def initialize window, x=0, y=0, angle=0
|
12
|
+
@window = window
|
13
|
+
@image = Gosu::Image.new @window, "#{Gembots::MEDIA}/projectile.png", false
|
14
|
+
@angle = angle
|
15
|
+
@x = x + Gosu::offset_x(@angle, 10)
|
16
|
+
@y = y + Gosu::offset_y(@angle, 10)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Method called via the arena.
|
20
|
+
# Moves the projectile 2 forward.
|
21
|
+
def update
|
22
|
+
@x += Gosu::offset_x @angle, 2
|
23
|
+
@y += Gosu::offset_y @angle, 2
|
24
|
+
@x %= 640
|
25
|
+
@y %= 480
|
26
|
+
end
|
27
|
+
|
28
|
+
# Method called via the arena.
|
29
|
+
def draw
|
30
|
+
@image.draw_rot @x, @y, 1, @angle - 90 % 360
|
31
|
+
end
|
32
|
+
end
|
data/media/cannon.png
ADDED
Binary file
|
Binary file
|
data/media/tank.png
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gembots
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.2
|
4
|
+
version: 0.1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- L8D
|
@@ -59,8 +59,19 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- gembots.gemspec
|
68
|
+
- lib/gembots.rb
|
62
69
|
- lib/gembots/arena.rb
|
63
70
|
- lib/gembots/bot.rb
|
71
|
+
- lib/gembots/projectile.rb
|
72
|
+
- media/cannon.png
|
73
|
+
- media/projectile.png
|
74
|
+
- media/tank.png
|
64
75
|
- test/test_arena.rb
|
65
76
|
homepage: http://github.com/L8D/gembots
|
66
77
|
licenses:
|