gembots 0.1.2 → 0.1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad9de32649b753655ebb462ea3f56dc2f2227e83
4
- data.tar.gz: 74426bf3ccbdf33f3357bf28c6c8c248f47b397e
3
+ metadata.gz: 0f10a6144686e6a0480a0a4de23bc4a444e4eb28
4
+ data.tar.gz: c09bffbd894587c59b3aed0be57066e3aa1101bf
5
5
  SHA512:
6
- metadata.gz: c1e86f79ca9ab9ae37c6306c9f7f81e45b6eba6ab929ebfb92ca85ac7948120ab1e687e34709940a52e2f632c2a81638998c13bb625928af39eb2c20084b2643
7
- data.tar.gz: 2fdf7b3c7e5a9fb8f380eab5257ca3fb68ab4d10d0338c7e00b6807f86d650ac7e2e6cddd13f3d01782a166ff054f9a4f89043b91117af7425d95f7440e633dc
6
+ metadata.gz: 256e4ef85339ae1a72a4556edc11d1de69dac327b463cfac2d3e303f1234a6f9b33d45e7f5cb79c079d62a222136933b56c1d34e0beb775f8836a0dacef92885
7
+ data.tar.gz: 43138da1dc9ec3b0d2d063718356c82b0b58116834109b345009d80b01176dcb32fe92c5c30e01173ce7dd22e6a06ae3e0a3804878ab4340ed9d09c636a340f5
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gembots.gemspec
4
+ gemspec
@@ -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.
@@ -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
@@ -0,0 +1,8 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |task|
4
+ task.libs << 'test'
5
+ end
6
+
7
+ desc "Run tests"
8
+ task :default => :test
@@ -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
@@ -0,0 +1,6 @@
1
+ require 'gosu'
2
+
3
+ module Gembots
4
+ MEDIA = File.expand_path '../media', File.dirname(__FILE__)
5
+ # stuff here
6
+ end
@@ -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, "media/tank.png", 32, 32, false)
21
- @image = Gosu::Image.new window, "media/cannon.png", false
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
Binary file
Binary file
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: