Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

SHOOTER BS Won´t run correct

I´ve some troubles with my Shooter-BS

How should it work?
On the first map, 5 Bullet Events will be saved in the hash. On a testmap ( later In-Game ), the Events will be cloned ( with the Script below ) and make there Movements. If they Hit Terrain 7, or (later) an Enemy, they will be Deleted with an Call_Skript Code.

What´s wrong?
The first 5 shots run correctly. but At and after the 6th shot. The Event won´t fly in correct speed, or it won´t fly.


Here´s the clone Skript.

#==============================================================================
# Event Cloning
#------------------------------------------------------------------------------
# Allows events to be copied and pasted between maps
# Made by: Huitzilopoctli @ rmxp.net
#------------------------------------------------------------------------------
#-To use this, you must first save an event into the hash class like this:
#---$saved_events[key]= id
#---Where key is a name for the event that can be used later, like a normal hash,
#-----and id is the id of the event you wish to save
#-To recall the event, use this:
#---$scene.add_event(key)
#---Where key is the handle you have to the event eariler
#-The Saved_Events class works just like a normal hash, so it can be cleared and
#---the entries in it altered
#==============================================================================
class Scene_Map

def add_event(index)
i = 1
key = nil
while !key
if !$game_map.events.keys.include?(i)
key = i
break
end
i += 1
end

$game_map.events[key] = $saved_events.copy(index, key)
@spriteset.add_char(key)
end

end

class Spriteset_Map

def add_char(key)
sprite = Sprite_Character.new(@viewport1, $game_map.events[key])
@character_sprites.push(sprite)
end

end

class Saved_Events < Hash

def []=(key, value)
super(key, $game_map.events[value].dup)
end

def copy(key, id)
event = self[key].dup
event.set_id(id)
return event
end

end

class Game_Event

def set_id(id)
@id = id
end

end

class Scene_Title

alias command_new_game_primary command_new_game
def command_new_game
$saved_events = Saved_Events.new

command_new_game_primary
end

end

class Scene_Save

alias write_save_data_primary write_save_data
def write_save_data(file)
write_save_data_primary(file)

Marshal.dump($saved_events, file)
end

end

class Scene_Load

alias read_save_data_primary read_save_data
def read_save_data(file)
read_save_data_primary(file)

$saved_events = Marshal.load(file)
end

end


And here are a Demo of my Problem ( It´s German... but the Codes and the Script in English. ):
SHOOTER-PROBLEM DEMO



Ps.: To shoot, turn down and move one step down. I´ve only made the direction lower_left, down and lwer_right. Shoot with SPACE.


Hope someone can help me, to solve the Problem with the Bullets... Thx.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top