For the first one you can do it with the bullet behavior and a negative gravity I think.
The second one you'd have to use the custom movement behavior with a negative horizontal acceleration.
Or you can do it with just events with and object "bullet" with instance variables vx and vy
on space pressed
--- player spawn bullet
--- bullet: set vx to 100
--- bullet: set vy to random(-20,20)
--- bullet: add -100*dt to vx
--- bullet: set position to (self.x+self.vx*dt, self.y+self.vy*dt)
^-that's to do the second picture. Fiddle with it and you can make the bullets accelerate in the other directions.