Is it possible to Switch from camera type 0 to 1 using script?

I'm interested in this too, I know how to change camera offsets but having the camera follow at certain areas of the stage and then switch back to unfollow I have no idea how to do

M6cHHUf.png
 
@PS_VITA and @danno:

I've looked over the code, and unfortunately there's no real-time access to camera type. Pretty big oversight on our part - sorry about that. You do have access to scroll positions and the camera offset, so you could still achieve the effect by creating your own camera position routine. You could also do it with screens. Obviously having access to cameratype would be simpler, and I'll see about adding it to the next release.

DC
 
@PS_VITA

As an alternative way, you can change the level property "camerazoffset" by using scripts inside onmovea/ondraw/update events.
In the code below, you have two ways to change the camera:

1) According to the current height
2) According to a defined "xpos" (or multiple xpos points in the level)

You will have to do some adjustments on the level sprites to look the same as a normal level. If your panel has the same height of the current resolution, the camera will not move.

pn00.gif

C:
void main()
{
    camera();
}

void camera(){
//Restart current level
    void self = getlocalvar("self");
    float y = getentityproperty(self, "y");
    float z = getentityproperty(self, "z");
    float b = getentityproperty(self, "base");
    float xpos = openborvariant("xpos");
    float ypos = openborvariant("ypos");
   
    if(y > b){changelevelproperty("camerazoffset", -y);}
    // if(xpos >= 10){changelevelproperty("camerazoffset", 0);}
    // if(xpos < 10){changelevelproperty("camerazoffset", -544);}
    drawstring(50, 50, 0, getlevelproperty("camerazoffset"));
}



@DCurrent
It can be very useful if we have the camera type accessible with scripts. If you like the idea, I can work on it.
 
Last edited:
@Kratus I can already achieve what I need to do using cameraoffsets as long as the player goes past the point of no return (once you go up you can't go back down) in your video the camera follows the player as they jump up and I wanted to switch that off (cameratype 0) and back on again at different points of the stage, the idea is to have a massive stage area while having complete control of camera type


have a look at the first level or 2:51 its subtle but it's there, thank you Kratus for your example.
 
@Kratus I can already achieve what I need to do using cameraoffsets as long as the player goes past the point of no return (once you go up you can't go back down) in your video the camera follows the player as they jump up and I wanted to switch that off (cameratype 0) and back on again at different points of the stage, the idea is to have a massive stage area while having complete control of camera type


have a look at the first level or 2:51 its subtle but it's there, thank you
@danno Hmm now I understand better. In this case you can use the code I posted as base and define multiple xpos ranges to enable/disable the camera follow feature.

In fact, the script I'm using basically replicates the native function "camera type 1" and you can fully customize or turn it off at any time. The only problem I haven't solved yet is the camera position when the level starts, because it always starts too high if the panel is bigger than the resolution.
 
@DCurrent
No problem buddy, I readed your post but I tried to help posting an practical example which I'm currently using :)
About the camera addition, I offered in case you are busy with other things.
It's all good, I just had to pull your chain a little. :)

Adding camera mode isn't any big deal. I'll take care of it soon. I'm working on a little something right now I don't want to jinx myself by posting.

DC
 
Scrollz?

scrollz {min} {max}

ScrollZ enables vertical scrolling in response to player movement along the Y or Z axis, and controls how far. There's potential to make 3D scrolling stages, but the main use of this is to enable vertical scrolling when players jump. Unlike ScrollX, ScrollZ does allow you to go scroll beyond the panel area, so if you don't set up panels and layers to accommodate you can scroll yourself right out the visual design of a level. Also note that entities are still confined to the level's Z boundaries. That's a good thing, since it means you could set up large ScrollZ values for vertically oriented scrolling but still keep Z movement limited within a defined area.
Obviously {min} is the minimum limit and {max} is the maximum limit.
This command only works in levels with direction left/right/both/leftright or rightleft.
Like other level objects, this command must be followed by 'at' (see above) and also counted by 'group'.
It must be followed by 'at'.

Example:

Scrollz 600 640
At 0

The camera scrolls within 40 pixels away from the walkable area and back to the lowest.
 
but having the camera follow at certain areas of the stage and then switch back to unfollow I have no idea how to do

The best way I know is to disable default camera and use scripted camera. I have coded scripted camera before which works like this:
1. At start, camera only move horizontally, to the right if either player 1 or player 2 moves to half right portion of the screen.
This rule applies until scroll position reaches certain value and if it is, go to #2 below.
2. Camera only move vertically down if either player 1 or player 2 moves to lower half portion of the screen *.
This rule applies until vertical scroll position reaches certain value and if it is, reenable camera.

Read attached lairscreen.txt below for the script. Actually the script has 3rd phase after camera reenable but it's not related to camera at all IIRC.
Oh, in case anyone wonders, the scripted camera is for level using lair1.png below (stage 5 of Double Dragon 2).

* It's been years so I'm not sure if it's lower half portion of the screen or something else 😅

The only problem I haven't solved yet is the camera position when the level starts, because it always starts too high if the panel is bigger than the resolution.

You can control starting camera position by modifying xpos and ypos with script.

If you've played Robo Magi, you can see that camera will start at where player enters the room, be it upstairs, downstairs, left side or right side.
I even have posted example script in this thread.
 

Attachments

You can control starting camera position by modifying xpos and ypos with script.

If you've played Robo Magi, you can see that camera will start at where player enters the room, be it upstairs, downstairs, left side or right side.
I even have posted example script in this thread.
@Bloodbane Oh man, it's true, I completely forgot it 😄 thanks!

After seeing your print I remembered that I'm already using scripts to control and memorize "xpos/ypos/cameraoffset" of the elevator's position in SORX/sor3 route/stage 6 at every time the player enters the rooms, similar as you're doing in your game.

bg01.png
 

I managed to achieve what I was looking for using camera offsets but it would be a massive pain to do if I wanted to make platforming through the stage more complicated like super mario, @DCurrent so If you could implement having camera access in the next build that would be great and would save wanting to power geyser through my computer out of frustration :ROFLMAO:
 
I'm always wondering why the ninjas explodes when we touch them. Are they terrorists who wear bombs? :)
I'm feeling so nostalgic when I'm seeing your video, going back 30 years and playing Revenge of Shinobi on my Megadrive / Genesis.
Thanks for these good memories ;) .
 
Last edited:
I'm always wondering why the ninjas explodes when we touch them. Are they terrorits that wear bombs? :)
I'm feeling so nostalgic when I'm seeing your video, going back 30 years and playing Revenge of Shinobi on my Megadrive / Genesis.
Thanks for these good memories ;) .
My favorite part is the stealth kill. Slow motion jump ~2 meters into the air, smash your sword down on the guy, and knock him at least 5 meters off the ledge to land with a thud. Then he explodes (of course). Silent killer indeed... It's even better since you could just walk up and poke him with your kunai for the same effect. :ROFLMAO:
 
Back
Top Bottom