-
Slow down camera speed?
Hello! I have a quick question for the community.
I have a vertical shooter that I am working on. Currently the way the level scrolling is done is through this:
I have an active object that is acting as my "Camera" that scrolls up the level.
I have the following to move the camera up the level
"Always" - Start loop "Scroll" 1 times
On Loop Scroll - Set Y Position "Camera" -1
Center Display "Camera" (0,0)
The problem with this, however, is that the scrolling speed is too fast for the level I am trying to do. Is there any way to slow the scrolling speed down? Or is there a more efficient way to make the camera scroll up the level period? Any help would be super amazing!
-
Store the camera position in a value. You can use the "Camera" object's Alterable Value Y for example:
Code:
+ Start of Frame
- Set "Camera" Alterable Value Y to "Camera" Y Position
+ Always
- Start loop "Scroll" 1 times
+ On Loop "Scroll"
- Substract 0.5 (or even less) from "Camera" Alterable Value Y
- Set Y Position "Camera" to "Camera" Alterable Value Y
- Center Display "Camera" (0,0)
Of course, you don't really need the Active Object "Camera". You can center the camera on two values instead of an object, but an Active is a good way to store values.
-
If you feel more comfortable without loops,
you could also set "camera" object movement to "bouncing ball"
set its initial direction to "up"
and its speed to a low value (try with 5-8)
you could also alter its speed during the game to create "pauses" with big enemies,
or other nice effects
-
@ Schrodinger
That worked beautifully! Problem is now that my ship seems to be moving faster than the camera and it goes off screen >.<
Any suggestions to keep the ship in the field scroll with the camera without leaving the arena?
-
Mmmm...
you could face the problem in many ways:
1) slow down the ship XD
2) speed up the camera (XDXD)
3) make a dynamic system, where the camera "chases" the ship if ship goes too far (variable scrolling speed)
for example when:
ship Y position < Y top coordinate of frame + 50
>> set camera speed to 20
or
>> set ship speed to 6
or easier,
in "position - is ship getting close to a window's edge"
i.e. 20 px
lower speed, or stop ship (this however causes a "muddy" effect), or bounce ship..
then revert to normal speed when ship returns down the screen
4) set ship to "stop" when leaving frame area,
(test position of ship --> click all outgoing arrows, this should create a "ship leaves the play area" event)
>>> ship movement - stop
in this way the ship will always be bounded to the screen area that is following the camera
Edit: sorry n° 4 is uncorrect, this works only for leaving actual frame area, not for windowed "screen" area.
-
1 Attachment(s)
Oh, sorry, another simpler/more effective way:
1) untick "follow the frame" for your spaceship, if it's ticked
2) create a "border" active object whose size = boundaries of your screen
3) untick "follow the frame" for the border object
4) in the event editor, make ship stop when colliding with "border" object
See example:
Attachment 16390
-
I'll try it when I get home :D
. However what I am really attempting to do is have the ship maintain the same speed of the camera. Meaning that if the player stops moving, the ship doesn't go towards the bottom as the camera pans up, but keeps moving forward at the same speed as the level/camera. Would those solution help with this?
Seriously appreciate the help ^_^ Learning a lot from these different examples
-
OK then you definitely should go with the last example! :)
Main thing to do is unticking "follow the frame" for the ship object in object's properties.
Then you may want to prevent the ship from slipping out by testing its position or adding a "border object" as in last example.
-
Thanks! I'll post the update the moment I am able to work on it :D!
-
This is very odd...when I untick the "Follow frame" option...my ship vanishes when I play
**EDIT**
Nevermind - fixed it :D
** Edit 2 **
No..I guess I didn't. What causes my ship to vanish whenever I unclick "Follow Frame?"