For lack of a better place to post this I'm plonking it here.
I felt like opening RPG Maker again, mainly after playing Deus Ex and thinking "oh hey you could sortof do that with RPG Maker? lol" but yeah.
So I started trying to make the mechanics for a shooting game.
This is what I have so far:
- pressing A fires a bullet from the player's location which moves in the direction the player is facing indefinately
- if there are more than 40 bullets they start disappearing from 0
- if the bullet hits an event, that event disappears
Very basic stuff so far.
Events:
Parallel process:
And then any enemies you want walking around the map.
Anyway, comments/suggestions/requests? I am thinking of making a simple game with this.
I felt like opening RPG Maker again, mainly after playing Deus Ex and thinking "oh hey you could sortof do that with RPG Maker? lol" but yeah.
So I started trying to make the mechanics for a shooting game.
This is what I have so far:
- pressing A fires a bullet from the player's location which moves in the direction the player is facing indefinately
- if there are more than 40 bullets they start disappearing from 0
- if the bullet hits an event, that event disappears
Very basic stuff so far.
Code:
#===============================================================================
# * Shoot Stuff
#===============================================================================
class Game_Event
attr_accessor :opacity
end
class Bullet
attr_accessor :tile_x
attr_accessor :tile_y
def initialize(x, y, dir)
@tile_x = x
@tile_y = y
@dir = dir
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.picture('bullet')
real_x = (@tile_x * 32) + 14
real_y = (@tile_y * 32) + 6
@sprite.x = real_x
@sprite.y = real_y
end
def update
for i in 1..($game_map.events.size)
ev_x = $game_map.events[i].x
ev_y = $game_map.events[i].y
if (ev_x == @tile_x) && (ev_y == @tile_y)
$game_map.events[i].opacity = 0
end
end
case @dir
when 2 #down
@sprite.y += 3
when 4 #left
@sprite.x -= 3
when 6 #right
@sprite.x += 3
when 8 #up
@sprite.y -= 3
end
@tile_x = (@sprite.x - 14) / 32
@tile_y = (@sprite.y - 6) / 32
@sprite.update
end
def dispose
@sprite.dispose
end
end
class Scene_Map
attr_accessor :bullets
attr_accessor :bullettime
alias :wy_initialize :initialize
alias :wy_update :update
def initialize
@bullets = []
wy_initialize
@bullettime = 0
end
def update
for i in 0..(@bullets.size - 1)
@bullets[i].update
end
if @bullets.size > 40
@bullets[0].dispose
@bullets.delete_at(0)
end
@bullettime += 1
wy_update
end
end
class Game_Player
attr_accessor :x
attr_accessor :y
end
class Interpreter
def fire
if $scene.is_a?(Scene_Map)
if $scene.bullettime > 5
player_x = $game_player.x
player_y = $game_player.y
dir = $game_player.direction
$scene.bullets.push(Bullet.new(player_x, player_y, dir))
$scene.bullettime = 0
end
end
end
end
Events:
Parallel process:
@> Conditional Branch: The X button is being pressed
@> Script: fire
@>
: Else
@>
: Branch End
@>
And then any enemies you want walking around the map.
Anyway, comments/suggestions/requests? I am thinking of making a simple game with this.