Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Sonic Dash (Open Source WIP)


Recommended Posts

any ideas on the problem i was having thow?

ive tried quite a few things, but i can't seem to get it work.

i want everything to act like room_width is 448 (views stopping as if it were, player stopping as if it were).

i can get the player to stop, but not the view

however, i did manage to get it working correctly, views aswell, but the problem is it that is displays an error - yet the only way it will work atm is if this error is displaied?

how can i do it without having to resort to an error?

to explain in full detail, i have created an image to explain...

as the png upload restrictions for the site would not allow the image, its been put on imageshack - clicky helpimage1bj2.th.png

Link to comment
Share on other sites

You lying whore! Why did you hide this from me?! ;_; [/jk]

Camera lock would be most appreciated, especially since it's needed for cutscenes, boss zones and such. Make sure the locking range is adjustable (so the camera view can adjust to room sizes).

Link to comment
Share on other sites

yup camera lock would be appreciated, but as i thought about the possibility of 'camera' lock not 'view lock' last nite while i was asleep (dont ask me why-the-(you get the picture) i was dreaming about a sonic engine)

Ill try do it now :P

Thow if i ever get to uploading the GM6 then if yoshi thought it was good enough, he might be able to tell me on how to improve :P

guess what....

if that screeny is real....... give us now !!!! jk lol

EDIT : CAMERA LOCK DONE - FOR ME ANYWAY. NOW FOR PLAYER LOCK :P

EDIT AGAIN : YUP DONE

Sorry Bout Long Post, But Auto Merge Means This Is How It Gotta Be

Camera/Player Lock Code

Currently Only Works For Limiting X Movement To The Right, But That Can Be Easily Extended

room_whatever

Add This To The Creation event (See Settings)


global.cameralimit = true;
global.cameralimitto = 448;
[/CODE]

[/size]

[b][size=5][font=Microsoft Sans Serif]objPlayerSonic[/font][/size][/b]

[b][size=3][font=Microsoft Sans Serif]Find This Code In The Step Event (Movement Bit)[/font][/size][/b]

[size=3]

[CODE]
if (x<16)
x = 16;
else if (x>room_width-16)
x = room_width-16;
[/CODE]

[/size]

And Replace With

[size=3]

[CODE]
if (x<16) {
x = 16;
}
else {
if (global.cameralimit) {
if (x>global.cameralimitto-16) {
x = global.cameralimitto - 16;
}
}
else {
if (x>room_width -16) {
x = room_width - 16;
}
}
}
[/CODE]

[/size]

[b][size=5][font=Microsoft Sans Serif]objPlayerSonic[/font][/size][/b]

[b][size=3][font=Microsoft Sans Serif]Find This Code In The Step Event (Control Bit)[/font][/size][/b]

[size=3]

[CODE]
if (x_speed > 0 && (player_collision_right(x,y,angle,maskBig) || x >= room_width-16))
x_speed = 0;
if (x_speed < 0 && (player_collision_left(x,y,angle,maskBig) || x <= 16))
x_speed = 0;
[/CODE]

[/size]

And Replace With

[size=3]

[CODE]
if (global.cameralimit) {
if (x_speed > 0 && (player_collision_right(x,y,angle,maskBig) || x >=global.cameralimitto-16)) {
x_speed = 0;
}
}
else {
if (x_speed > 0 && (player_collision_right(x,y,angle,maskBig) || x >=room_width-16)) {
x_speed = 0;
}
}
if (x_speed < 0 && (player_collision_left(x,y,angle,maskBig) || x <= 16))
x_speed = 0;
[/CODE]

[/size]

[b][size=5][font=Microsoft Sans Serif]objPlayerSonic[/font][/size][/b]

[b][size=3][font=Microsoft Sans Serif]Find This Code In The End Step Event (3rd Script In The 4 That Are In The Event)[/font][/size][/b]

[size=3]

[CODE]
global.camera.x = floor(interpolate_values(x+look_shift_x, global.camera.x, 0.8));
global.camera.y = floor(interpolate_values(y+look_shift_y, global.camera.y, 0.8));
[/CODE]

[/size]

And Replace With

[size=3]

[CODE]
camx = floor(interpolate_values(x+look_shift_x, global.camera.x, 0.8));
camy = floor(interpolate_values(y+look_shift_y, global.camera.y, 0.8));
if (global.cameralimit) {
if (camx > (global.cameralimitto - view_hborder)) {
camx = (global.cameralimitto - view_hborder);
}
}
global.camera.x = camx;
global.camera.y = camy;
[/CODE]

[/size]

And if you are doing a boss, then you could add this code for once the boss has been defeated.

[size=3]

[CODE]
global.cameralimit = false;
global.cameralimitto = -1;
view_xview += 10;
[/CODE]

[/size]

Link to comment
Share on other sites

Um, what's a code to go the the next room? Life, if I added anobj and sonic collides with it, he goes to the next room.

Umm.....

I use in the step event of the actual object

if (distance_to_object(global.player1) == 0) {
	sound_stop_all();
	room_goto(whateverrroom);
	// whatever other handles nessacerry
	instance_destroy();
}

Below is a double post that has been automagically merged into the original.

thanks for wanting to contribute to Sonic Dash. i dont mind adding your content to the game, just upload it, and i will merge it with the newest version.

Ill take you up on that.

Included is a note_to_rougeyoshi.txt file :P

*Uploads*

*Upload Finishes And Gives Me Error Message 'Invalid Post specified. If you followed a valid link, please notify the administrator'

*Decides To Upload Later As DarthCrap Is Going To The Libary To Get A Book He Ordered*

Link to comment
Share on other sites

I had already implemented it, though it's somewhat different, but allows to limit camera to almost all values you'll need:

roomStart's creation event

Where

global.camera       = 0;

Add below

global.camera       = 0;
global.camera_min_x = 0;
global.camera_max_x = 0;
global.camera_min_y = 0;
global.camera_max_y = 0;

objController creation event

Where

    if (global.checkpoint_x == 0)
        global.camera = instance_create(objStartPlace.x, objStartPlace.y-8, objCamera);
    else
        global.camera = instance_create(global.checkpoint_x, global.checkpoint_y, objCamera);

Add below

    global.camera_min_x = 0;
    global.camera_max_x = room_width-1;
    global.camera_min_y = 0;
    global.camera_max_y = room_height-1;

objPlayerSonic step event

Where

            // move the player back inside the room
            if (x&lt;16) x = 16;
            if (x&gt;(room_width-16)) x = room_width-16;

Replace with

            // move the player back inside the room
            if (x&lt;(global.camera_min_x+16)) x = global.camera_min_x+16;
            if (x&gt;(global.camera_max_x-16)) x = global.camera_max_x-16;

Where

        if (x_speed &gt; 0 &amp;&amp; (player_collision_right(x,y,angle,maskBig) || x &gt;= room_width-16))
            x_speed = 0;
        if (x_speed &lt; 0 &amp;&amp; (player_collision_left(x,y,angle,maskBig) || x &lt;= 16))
            x_speed = 0;

replace with

        if (x_speed &gt; 0 &amp;&amp; (player_collision_right(x,y,angle,maskBig) || x &gt;= (global.camera_max_x-16)))
            x_speed = 0;
        if (x_speed &lt; 0 &amp;&amp; (player_collision_left(x,y,angle,maskBig) || x &lt;= (global.camera_min_x+16)))
            x_speed = 0;

And finally, where camera repositions, replace it with

        global.camera.x = floor(interpolate_values(max(global.camera_min_x+view_hborder, min(global.camera_max_x-view_hborder, x+look_shift_x)), global.camera.x, 0.8));
        global.camera.y = floor(interpolate_values(max(global.camera_min_y+view_vborder, min(global.camera_max_y-view_vborder, y+look_shift_y)), global.camera.y, 0.8));

DarthCrap, you seem very skilled programming with GM, how did you find this site? :D

Link to comment
Share on other sites

I had already implemented it, though it's somewhat different, but allows to limit camera to almost all values you'll need:

roomStart's creation event

Where

global.camera       = 0;

Add below

[b]global.camera       = 0; // - [SIZE="6"]DAMIZEAN U DONT NEED THIS IF U'VE ALREADY GOT IT [/SIZE][/b] Big Letters Just To Make It Stand Out
global.camera_min_x = 0;
global.camera_max_x = 0;
global.camera_min_y = 0;
global.camera_max_y = 0;

objController creation event

Where

    if (global.checkpoint_x == 0)
        global.camera = instance_create(objStartPlace.x, objStartPlace.y-8, objCamera);
    else
        global.camera = instance_create(global.checkpoint_x, global.checkpoint_y, objCamera);

Add below

    global.camera_min_x = 0;
    global.camera_max_x = room_width-1;
    global.camera_min_y = 0;
    global.camera_max_y = room_height-1;

objPlayerSonic step event

Where

            // move the player back inside the room
            if (x&lt;16) x = 16;
            if (x&gt;(room_width-16)) x = room_width-16;

Replace with

            // move the player back inside the room
            if (x&lt;(global.camera_min_x+16)) x = global.camera_min_x+16;
            if (x&gt;(global.camera_max_x-16)) x = global.camera_max_x-16;

Where

        if (x_speed &gt; 0 &amp;&amp; (player_collision_right(x,y,angle,maskBig) || x &gt;= room_width-16))
            x_speed = 0;
        if (x_speed &lt; 0 &amp;&amp; (player_collision_left(x,y,angle,maskBig) || x &lt;= 16))
            x_speed = 0;

replace with

        if (x_speed &gt; 0 &amp;&amp; (player_collision_right(x,y,angle,maskBig) || x &gt;= (global.camera_max_x-16)))
            x_speed = 0;
        if (x_speed &lt; 0 &amp;&amp; (player_collision_left(x,y,angle,maskBig) || x &lt;= (global.camera_min_x+16)))
            x_speed = 0;

And finally, where camera repositions, replace it with

        global.camera.x = floor(interpolate_values(max(global.camera_min_x+view_hborder, min(global.camera_max_x-view_hborder, x+look_shift_x)), global.camera.x, 0.8));
        global.camera.y = floor(interpolate_values(max(global.camera_min_y+view_vborder, min(global.camera_max_y-view_vborder, y+look_shift_y)), global.camera.y, 0.8));

DarthCrap, you seem very skilled programming with GM, how did you find this site? :D

The Camera Code - Ill try that :P

EDIT : Where do you set the values? objController is a global object so where can u set individual level camera_min/max values?

Where i got to this site from - ure post on gm forums lol :P I had the original (very old) sonic 360 engine and did a gm forums search and ure 'pack of stuff beta' post came up :P

Its also lucky that the file i was trying to upload didn't upload b4 - i had forgotton the BOSS.mp3 file which is important as it does dynamic load.

EDIT : I Got the invalid id error message again, must be smthin to do with the forum uploader not working

Link to comment
Share on other sites

EDIT: nvm, hes just changing servers

Um, what's a code to go the the next room? Life, if I added anobj and sonic collides with it, he goes to the next room.

room_goto_next(); is what you need, but you'll want a transition if you want it to look smooth.

Link to comment
Share on other sites

@damizean - can u read that post i posted earlier (http://www.sfghqmb.com/showpost.php?p=14492&page=3)

I dunno, im not sure but i think i found a slight prob wiv ure camera script

@anyone

http://hosted.filefront.com/DarthCrap2/

the xtended version (finished level and added boss) is available there, but it has been made in the 6th aug version of the engine so needs to be upgraded

Link to comment
Share on other sites

@damizean - can u read that post i posted earlier (http://www.sfghqmb.com/showpost.php?p=14492&page=3)

I dunno, im not sure but i think i found a slight prob wiv ure camera script

@anyone

http://hosted.filefront.com/DarthCrap2/

the xtended version (finished level and added boss) is available there, but it has been made in the 6th aug version of the engine so needs to be upgraded

If you need to set camera specific stuff better make an object for those purposses, or already edit objController and do it based on current room.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...