windstille-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Windstille-devel] rev 401 - trunk/src


From: Ingo Ruhnke
Subject: [Windstille-devel] rev 401 - trunk/src
Date: Mon, 07 Jun 2004 22:56:24 +0200

Author: grumbel
Date: 2004-06-07 22:56:24 +0200 (Mon, 07 Jun 2004)
New Revision: 401

Added:
   trunk/src/flexlay_wrap.hxx
Modified:
   trunk/src/flexlay.rb
   trunk/src/flexlay_wrap.i
   trunk/src/gui.rb
   trunk/src/gui2.rb
   trunk/src/level.rb
   trunk/src/object_brush.cxx
   trunk/src/object_brush.hxx
   trunk/src/object_selector.cxx
   trunk/src/object_selector.hxx
   trunk/src/ruby_functor.cxx
   trunk/src/ruby_functor.hxx
   trunk/src/ruby_meta_data.cxx
   trunk/src/ruby_meta_data.hxx
   trunk/src/sector.rb
   trunk/src/supertux.rb
Log:
- callback for object dropping
- better sector support
- bunch of other save issues fixed

Modified: trunk/src/flexlay.rb
===================================================================
--- trunk/src/flexlay.rb        2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/flexlay.rb        2004-06-07 20:56:24 UTC (rev 401)
@@ -65,7 +65,6 @@
   end
   
   def on_ok()
-    print "OK: ", @callback
     @window.hide();
     if @callback
       @callback.call(@inputbox.get_text())
@@ -73,7 +72,6 @@
   end
   
   def on_cancel()
-    print "CANCEL"
     @window.hide();
   end
 end
@@ -97,12 +95,10 @@
   end
 
   def on_cancel()
-    print "ON CANCEL\n"
     @window.hide()
   end
   
   def on_ok()
-    print "ON OK\n"
     @window.hide()
     if @callback
       vals = @items.map{|item|

Added: trunk/src/flexlay_wrap.hxx
===================================================================
--- trunk/src/flexlay_wrap.hxx  2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/flexlay_wrap.hxx  2004-06-07 20:56:24 UTC (rev 401)
@@ -0,0 +1,31 @@
+//  $Id$
+// 
+//  Pingus - A free Lemmings clone
+//  Copyright (C) 2002 Ingo Ruhnke <address@hidden>
+//
+//  This program is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU General Public License
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+// 
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
+#ifndef HEADER_FLEXLAY_WRAP_HXX
+#define HEADER_FLEXLAY_WRAP_HXX
+
+#include "ruby.h"
+
+class ObjMapObject;
+
+VALUE ObjMapObject2Value(const ObjMapObject& arg);
+
+#endif
+
+/* EOF */

Modified: trunk/src/flexlay_wrap.i
===================================================================
--- trunk/src/flexlay_wrap.i    2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/flexlay_wrap.i    2004-06-07 20:56:24 UTC (rev 401)
@@ -62,6 +62,13 @@
 #include "ruby_sexpr_parser.hxx"
 #include "ruby_meta_data.hxx"
 #include "ruby_functor.hxx"
+
+VALUE ObjMapObject2Value(const ObjMapObject& arg)
+{
+ ObjMapObject* resultptr = new ObjMapObject(arg);
+ return SWIG_NewPointerObj((void *) resultptr, SWIGTYPE_p_ObjMapObject, 1);
+}
+
 #endif
 %}
 
@@ -125,4 +132,5 @@
 %include "ruby_sexpr_parser.hxx"
 #endif
 
+
 /* EOF */

Modified: trunk/src/gui.rb
===================================================================
--- trunk/src/gui.rb    2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/gui.rb    2004-06-07 20:56:24 UTC (rev 401)
@@ -1,9 +1,3 @@
-class BadGuy
-  def initialize(type)
-    @type = type
-  end
-end
-
 class SuperTuxGUI
   quit_button = nil
   menu        = nil
@@ -23,12 +17,21 @@
     @objectselector = ObjectSelector.new(CL_Rect.new(0, 0, 128, 256), 42, 42, 
@selector_window)
     @objectselector.show(true)
 
+    connect_v1_ObjMapObject(@objectselector.sig_drop(), 
method(:on_object_drop))
+
     $game_objects.each do |object|
       @objectselector.add_brush(ObjectBrush.new(make_sprite($datadir + 
object[1]),
-                                                
make_metadata(BadGuy.new(object[0]))))
+                                                make_metadata(object)))
     end
   end
 
+  def on_object_drop(cppobj)
+    # Get the metadata info and extract the generator call from it, see 
$game_objects
+    print "on_object_drop:\n"
+    metadata = get_ruby_object(cppobj.get_metadata())
+    cppobj.set_metadata(make_metadata(metadata[2].call()))
+  end
+
   def show_objects()
     @tileselector.show(false)        
     @objectselector.show(true)
@@ -57,6 +60,7 @@
 
 def gui_level_save()
   filename = $workspace.get_map().get_metadata().parent.filename
+  print "Filename: ", filename, "\n"
   if filename
     $save_dialog.set_filename(filename)
   else
@@ -257,7 +261,13 @@
 end
 
 def supertux_save_level(filename)
-  $workspace.get_map().get_metadata().parent.save(filename)
+  level = $workspace.get_map().get_metadata().parent
+  # Do backup save
+  if File.exists?(filename) then
+    File.rename(filename, filename + "~")
+  end
+  level.save(filename)
+  level.filename = filename
 end
 
 def gui_switch_sector_menu()
@@ -277,19 +287,20 @@
   mymenu.run()
 end
 
+def gui_remove_sector()
+  sector = $workspace.get_map().get_metadata()
+  sector.get_level().remove_sector(sector.name)
+end
+
 def gui_add_sector()
   level = $workspace.get_map().get_metadata().get_level()
   dialog = GenericDialog.new("Add Sector", $gui.get_component())
-
-  name = "newsector"
-  width  = 50
-  height = 20
+ 
+  dialog.add_string("Name: ", newsector)
+  dialog.add_int("Width: ",   30)
+  dialog.add_int("Height: ",  20)
   
-  dialog.add_string("Name: ", name)
-  dialog.add_int("Width: ",   width)
-  dialog.add_int("Height: ",  height)
-  
-  dialog.set_callback(proc { |name, w, h|
+  dialog.set_callback(proc { |name, width, height|
                         uniq_name = name
                         i = 1
                         while level.get_sectors().index(uniq_name)
@@ -299,7 +310,8 @@
 
                         sector = Sector.new(level)
                         sector.new_from_size(uniq_name, width, height)
-                        level.add_sector(sector) })
+                        level.add_sector(sector) 
+                      })
 end  
 
 # EOF #

Modified: trunk/src/gui2.rb
===================================================================
--- trunk/src/gui2.rb   2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/gui2.rb   2004-06-07 20:56:24 UTC (rev 401)
@@ -123,6 +123,7 @@
 $menu.add_item("Edit/Resize to selection", proc{ 
gui_resize_level_to_selection()})
 $menu.add_item("Edit/Debug Shell", proc{ run_python()})
 $menu.add_item("Edit/Add Sector...", proc{ gui_add_sector()})
+$menu.add_item("Edit/Remove Current Sector", proc{ gui_remove_sector()})
 
 $menu.add_item("Zoom/1:4 (25%) ",  proc{ gui_set_zoom(0.25) })
 $menu.add_item("Zoom/1:2 (50%) ",  proc{ gui_set_zoom(0.5) })
@@ -144,14 +145,6 @@
 gui_show_current()
 set_tilemap_paint_tool()
 
-class PathNode
-  node = nil
-  
-  def initialize(node)
-    @node = node
-  end
-end
-
 def insert_path_node(x,y)
   print "Insert path Node"
   m = $workspace.get_map().get_metadata()
@@ -166,7 +159,7 @@
   pathnodes = []
   for i in objmap_select_tool.get_selection()
     obj = get_ruby_object(i.get_metadata())
-    if obj.__class__ == PathNode
+    if obj.class == PathNode
       pathnodes.push(obj.node)
     end
   end
@@ -180,6 +173,20 @@
   end
 end
             
+def gui_show_object_properties()
+  filename = $workspace.get_map().get_metadata().objects
+  $objmap_select_tool.get_selection()
+  selection = $objmap_select_tool.get_selection()
+  if selection.length() > 1 then
+    print "Warning: Selection to large"
+  elsif selection.length() == 1 then
+    obj = get_ruby_object(selection[0].get_metadata())
+    obj.property_dialog()
+  else
+    print "Warning: Selection is empty\n"
+  end
+end
+
 connect_v2($editor_map.sig_on_key("f1"), proc{ |x, y| gui_toggle_minimap()})
 connect_v2($editor_map.sig_on_key("m"),  proc{ |x, y| gui_toggle_minimap()})
 connect_v2($editor_map.sig_on_key("g"),  proc{ |x, y| gui_toggle_grid()})
@@ -197,4 +204,6 @@
 connect_v2($editor_map.sig_on_key("7"),  proc{ |x, y| 
$workspace.get_map().get_metadata().parent.activate_sector("main", $workspace)})
 connect_v2($editor_map.sig_on_key("8"),  proc{ |x, y| 
$workspace.get_map().get_metadata().parent.activate_sector("another_world", 
$workspace)})
 
+connect_v2($editor_map.sig_on_key("e"),  proc{ |x, y| 
gui_show_object_properties()})
+
 # EOF #

Modified: trunk/src/level.rb
===================================================================
--- trunk/src/level.rb  2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/level.rb  2004-06-07 20:56:24 UTC (rev 401)
@@ -145,7 +145,7 @@
     f.write("    (path\n")
     for obj in @objects.get_objects()
       pathnode = get_ruby_object(obj.get_metadata())
-      if (pathnode.__class__ == PathNode)
+      if (pathnode.class() == PathNode)
         f.write("     (point (x %d) (y %d) (speed 1))\n" % obj.get_pos().x, 
obj.get_pos().y)
       end
     end
@@ -154,7 +154,7 @@
     f.write("  (objects\n")
     for obj in @objects.get_objects()
       badguy = get_ruby_object(obj.get_metadata())
-      if (badguy.__class__ == BadGuy)
+      if (badguy.class == BadGuy)
         pos    = obj.get_pos()
         if (badguy.type != "resetpoint")
           f.write("     (%s (x %d) (y %d))\n" % badguy.type, int(pos.x), 
int(pos.y))
@@ -166,7 +166,7 @@
     f.write("  (reset-points\n")
     for obj in @objects.get_objects()
       badguy = get_ruby_object(obj.get_metadata())
-      if (badguy.__class__ == BadGuy)
+      if (badguy.class == BadGuy)
         pos    = obj.get_pos()
         if (badguy.type == "resetpoint")
           f.write("     (point (x %d) (y %d))\n" % (pos.x.to_i), pos.y.to_i)
@@ -192,6 +192,14 @@
     @sectors.push(sector)
   end
 
+  def remove_sector(name)
+    if @sectors.length() > 1
+      @sectors.delete_if{|sec| sec.name == name}
+    else
+      print "Only one sector left, can't delete it\n"
+    end
+  end
+
   def get_sectors()
     return @sectors.map {|sec| sec.name}
   end

Modified: trunk/src/object_brush.cxx
===================================================================
--- trunk/src/object_brush.cxx  2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/object_brush.cxx  2004-06-07 20:56:24 UTC (rev 401)
@@ -50,6 +50,12 @@
   return impl->sprite;
 }
 
+MetaData
+ObjectBrush::get_data()
+{
+  return impl->data;
+}
+
 ObjMapSpriteObject
 ObjectBrush::to_sprite_object(const CL_Point& pos)
 {

Modified: trunk/src/object_brush.hxx
===================================================================
--- trunk/src/object_brush.hxx  2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/object_brush.hxx  2004-06-07 20:56:24 UTC (rev 401)
@@ -37,6 +37,7 @@
               const MetaData& data_);
 
   CL_Sprite get_sprite();
+  MetaData get_data();
 
   ObjMapSpriteObject to_sprite_object(const CL_Point& pos);
 private:

Modified: trunk/src/object_selector.cxx
===================================================================
--- trunk/src/object_selector.cxx       2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/object_selector.cxx       2004-06-07 20:56:24 UTC (rev 401)
@@ -71,9 +71,14 @@
                                 screen.y - 
EditorMapComponent::current()->get_screen_rect().top);
       
                 ObjectAddCommand command(ObjectLayer::current());
-                command.add_object(brushes[drag_obj].to_sprite_object
-                                   
(EditorMapComponent::current()->screen2world(target)).to_object());
+
+                ObjMapObject obj = brushes[drag_obj].to_sprite_object
+                  
(EditorMapComponent::current()->screen2world(target)).to_object();
+
+                command.add_object(obj);
                 Workspace::current().get_map().execute(command.to_command());
+                
+                on_drop(obj);
               }
             drag_obj = -1;
           }
@@ -197,4 +202,10 @@
   brushes.push_back(brush);
 }
 
+CL_Signal_v1<ObjMapObject>&
+ObjectSelector::sig_drop()
+{
+  return on_drop;
+}
+
 /* EOF */

Modified: trunk/src/object_selector.hxx
===================================================================
--- trunk/src/object_selector.hxx       2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/object_selector.hxx       2004-06-07 20:56:24 UTC (rev 401)
@@ -48,7 +48,9 @@
 
   std::vector<ObjectBrush> brushes;
   int drag_obj;
-  
+
+  CL_Signal_v1<ObjMapObject> on_drop;
+
 public:
   ObjectSelector(const CL_Rect& rect, int obj_w, int obj_h, CL_Component* 
parent);
   ~ObjectSelector();
@@ -56,6 +58,7 @@
   void draw();
   void add_brush(const ObjectBrush& brush);
 
+  CL_Signal_v1<ObjMapObject>& sig_drop();
 private:
   void mouse_move(const CL_InputEvent& event);
   void mouse_down(const CL_InputEvent& event);

Modified: trunk/src/ruby_functor.cxx
===================================================================
--- trunk/src/ruby_functor.cxx  2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/ruby_functor.cxx  2004-06-07 20:56:24 UTC (rev 401)
@@ -17,8 +17,16 @@
 //  along with this program; if not, write to the Free Software
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+#include <iostream>
+#include "flexlay_wrap.hxx"
 #include "ruby_functor.hxx"
 
+VALUE
+RubyFunctor::call_protected(VALUE self)
+{
+  return rb_funcall(reinterpret_cast<RubyFunctor*>(self)->val.ptr(), 
rb_intern("call"), 0);
+}
+
 RubyFunctor::RubyFunctor(const RubyObject& val_)
   : val(val_)
 {
@@ -31,7 +39,22 @@
 void
 RubyFunctor::operator()()
 {
-  rb_funcall(val.ptr(), rb_intern("call"), 0);
+  int state = 0;
+  rb_protect(&RubyFunctor::call_protected, reinterpret_cast<VALUE>(this), 
&state);
+  if (state)
+    {
+      // FIXME: Potential memory leak
+      std::cout << "######################################################" << 
std::endl;
+      std::cout << "RubyException: " 
+                << rb_str2cstr(rb_inspect(ruby_errinfo), 0) 
+                << std::endl;
+
+      VALUE trace = rb_funcall(ruby_errinfo, rb_intern("backtrace"), 0);
+      for (int i = 0; i < RARRAY(trace)->len; ++i)
+        std::cout << rb_str2cstr(rb_ary_entry(trace, i), 0) << std::endl;
+      std::cout << "######################################################" << 
std::endl;
+      ruby_errinfo = Qnil;
+    }
 }
 
 void
@@ -46,4 +69,11 @@
   rb_funcall(val.ptr(), rb_intern("call"), 2, INT2FIX(x), INT2FIX(y));
 }
 
+void
+RubyFunctor::operator()(ObjMapObject obj)
+{
+  VALUE argval = ObjMapObject2Value(obj);
+  rb_funcall(val.ptr(), rb_intern("call"), 1, argval);
+}
+
 /* EOF */

Modified: trunk/src/ruby_functor.hxx
===================================================================
--- trunk/src/ruby_functor.hxx  2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/ruby_functor.hxx  2004-06-07 20:56:24 UTC (rev 401)
@@ -21,6 +21,7 @@
 #define HEADER_RUBY_FUNCTOR_HXX
 
 #include "ruby.h"
+#include "objmap_object.hxx"
 #include "ruby_object.hxx"
 
 /** */
@@ -36,6 +37,10 @@
   void operator()();
   void operator()(int i);
   void operator()(int x, int y);
+
+  void operator()(ObjMapObject obj);
+
+  static VALUE call_protected(VALUE self);
 };
 
 #endif

Modified: trunk/src/ruby_meta_data.cxx
===================================================================
--- trunk/src/ruby_meta_data.cxx        2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/ruby_meta_data.cxx        2004-06-07 20:56:24 UTC (rev 401)
@@ -63,4 +63,10 @@
   new CL_Slot(sig.connect_functor(RubyFunctor(obj)));
 }
 
+void connect_v1_ObjMapObject(CL_Signal_v1<ObjMapObject>& sig, VALUE func)
+{
+  sig = CL_Signal_v1<ObjMapObject>();
+  new CL_Slot(sig.connect_functor(RubyFunctor(func)));
+}
+
 /* EOF */

Modified: trunk/src/ruby_meta_data.hxx
===================================================================
--- trunk/src/ruby_meta_data.hxx        2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/ruby_meta_data.hxx        2004-06-07 20:56:24 UTC (rev 401)
@@ -31,6 +31,8 @@
 void connect_v1(CL_Signal_v1<int>& sig, VALUE obj);
 void connect_v2(CL_Signal_v2<int, int>& sig, VALUE obj);
 
+void connect_v1_ObjMapObject(CL_Signal_v1<ObjMapObject>& sig, VALUE func);
+
 #endif
 
 /* EOF */

Modified: trunk/src/sector.rb
===================================================================
--- trunk/src/sector.rb 2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/sector.rb 2004-06-07 20:56:24 UTC (rev 401)
@@ -14,7 +14,7 @@
   objects   = nil
   editormap = nil
 
-  attr_reader :name, :background, :interactive, :foreground, :parent, :width, 
:height
+  attr_reader :name, :objects, :background, :interactive, :foreground, 
:parent, :width, :height
   attr_writer :name, :song, :gravity
   
   def initialize(parent)
@@ -58,7 +58,7 @@
 
   def load_v1(data)
     @name = "<No Name>"
-    @song = "<No Song>"
+    @song = "supertux-1.ogg"
     @gravity = 10.0
     
     @width  = get_value_from_tree(["width", "_"], data, 20)
@@ -112,7 +112,7 @@
   
   def load_v2(data)
     @name = "<No Name>"
-    @song = "<No Song>"
+    @song = "supertux-1.ogg"
     @gravity = 10.0
     
     @width  = 20
@@ -159,9 +159,16 @@
           (name, image) = object
           x = get_value_from_tree(["x", "_"], data, 0)
           y = get_value_from_tree(["y", "_"], data, 0)
+
+          if name == "door"
+            metadata = make_metadata(Door.new(data))
+          else
+            metadata = make_metadata(BadGuy.new(name))
+          end
+
           @objects.add_object(ObjMapSpriteObject.new(make_sprite($datadir + 
image),
                                                      CL_Point.new(x, y),
-                                                     
make_metadata(BadGuy.new(name))).to_object())
+                                                     metadata).to_object())
         else
           print "Error: Couldn't resolve object type: ", name, "\n"
           print "Sector: Unhandled tag: ", name, "\n"
@@ -227,44 +234,31 @@
     f.write("    (music  \"%s\")\n" % @song)
     f.write("    (gravity %f)\n" % @gravity)
     
+    # FIXME: Make me configurable
+    f.write("    (background (image \"arctis.jpg\")\n" +
+            "                (speed 0.5))\n")
+   
     save_tilemap(f, @background,  "background")
     save_tilemap(f, @interactive, "main", :solid)
     save_tilemap(f, @foreground,  "foreground")
 
     f.write("    (camera\n")
-    f.write("      (mode \"autoscroll\")\n")
+    f.write("      (mode \"normal\")\n")
     f.write("      (path\n")
     for obj in @objects.get_objects()
       pathnode = get_ruby_object(obj.get_metadata())
-      if (pathnode.__class__ == PathNode)
+      if (pathnode.is_a?(PathNode))
         f.write("       (point (x %d) (y %d) (speed 1))\n" % obj.get_pos().x, 
obj.get_pos().y)
       end
     end
     f.write("    ))\n\n")
 
-    f.write("    (objects\n")
     for obj in @objects.get_objects()
       badguy = get_ruby_object(obj.get_metadata())
-      if (badguy.__class__ == BadGuy)
-        pos    = obj.get_pos()
-        if (badguy.type != "resetpoint")
-          f.write("       (%s (x %d) (y %d))\n" % badguy.type, int(pos.x), 
int(pos.y))
-        end
+      if (badguy.is_a?(GameObj))
+        badguy.save(f, obj)
       end
     end
-    f.write("    )\n\n")
-
-    f.write("    (reset-points\n")
-    for obj in @objects.get_objects()
-      badguy = get_ruby_object(obj.get_metadata())
-      if (badguy.__class__ == BadGuy)
-        pos    = obj.get_pos()
-        if (badguy.type == "resetpoint")
-          f.write("       (point (x %d) (y %d))\n" % int(pos.x), int(pos.y))
-        end
-      end
-    end
-    f.write("    )\n\n")
   end
 end
 

Modified: trunk/src/supertux.rb
===================================================================
--- trunk/src/supertux.rb       2004-06-07 11:08:57 UTC (rev 400)
+++ trunk/src/supertux.rb       2004-06-07 20:56:24 UTC (rev 401)
@@ -9,7 +9,7 @@
 include Flexlay_wrap
 
 require "flexlay.rb"
-
+require "gameobj.rb"
 require "sexpr.rb"
 
 #import os
@@ -40,7 +40,8 @@
 $mysprite = make_sprite("../data/images/icons16/stock_paste-16.png")
 
 $recent_files_menu = Menu.new(CL_Point.new(32*2, 54), $gui.get_component())
-for filename in $recent_files
+
+$recent_files.each do |filename|
   $recent_files_menu.add_item($mysprite, filename, proc{ 
supertux_load_level(filename) })
 end
 
@@ -131,20 +132,21 @@
 $tileset = Tileset.new(32)
 Tileset_load($tileset, $datadir + "images/tilesets/supertux.stgt")
 
-$game_objects = [["money", "images/shared/jumpy-left-middle-0.png"],
-                 ["snowball", "images/shared/snowball-left-0.png"],
-                 ["mriceblock", "images/shared/mriceblock-left-0.png"],
-                 ["mrbomb", "images/shared/mrbomb-left-0.png"],
-                 ["flame", "images/shared/flame-0.png"], 
-                 ["stalactite", "images/shared/stalactite.png"],
-                 ["fish", "images/shared/fish-left-0.png"],
-                 ["flyingsnowball", "images/shared/flyingsnowball-left-0.png"],
-                 ["bouncingsnowball", 
"images/shared/bouncingsnowball-left-0.png"],
-                 ["spiky", "images/shared/spiky-left-0.png"],
-                 ["resetpoint", "images/shared/resetpoint.png"],
-                 ["playerspawn", "images/shared/resetpoint.png"],
-                 ["door", "images/shared/door.png"],
-                 ["trampoline", "images/shared/trampoline-1.png"]]
+$game_objects = [
+  ["money", "images/shared/jumpy-left-middle-0.png", 
proc{BadGuy.new("money")}],
+  ["snowball", "images/shared/snowball-left-0.png", 
proc{BadGuy.new("snowball")}],
+  ["mriceblock", "images/shared/mriceblock-left-0.png", 
proc{BadGuy.new("mriceblock")}],
+  ["mrbomb", "images/shared/mrbomb-left-0.png", proc{BadGuy.new("mrbomb")}],
+  ["flame", "images/shared/flame-0.png", proc{BadGuy.new("flame")}], 
+  ["stalactite", "images/shared/stalactite.png", 
proc{BadGuy.new("stalactite")}],
+  ["fish", "images/shared/fish-left-0.png", proc{BadGuy.new("fish")}],
+  ["flyingsnowball", "images/shared/flyingsnowball-left-0.png", 
proc{BadGuy.new("flyingsnowball")}],
+  ["bouncingsnowball", "images/shared/bouncingsnowball-left-0.png", 
proc{BadGuy.new("bouncingsnowball")}],
+  ["spiky", "images/shared/spiky-left-0.png", proc{BadGuy.new("spiky")}],
+  ["playerspawn", "images/shared/resetpoint.png", proc{SpawnPoint.new()}],
+  ["door", "images/shared/door.png", proc{Door.new()}],
+  ["trampoline", "images/shared/trampoline-1.png", 
proc{BadGuy.new("trampoline")}]
+]
 
 require "level.rb"
 require "sector.rb"





reply via email to

[Prev in Thread] Current Thread [Next in Thread]