Skip to content

Commit

Permalink
Merge pull request #75 from jack27121/2.3.1
Browse files Browse the repository at this point in the history
2.3.1
  • Loading branch information
jack27121 committed May 11, 2024
2 parents bc57bfa + ab4f1a8 commit 0bccb4c
Show file tree
Hide file tree
Showing 14 changed files with 185 additions and 127 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
# Stitch files
stitch.config.json
tmp/
/options
8 changes: 8 additions & 0 deletions objects/obj_camera_pixel_grid/Create_0.gml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ resolutions = [
{w:1280, h:720},
{w:1920, h:1080}
];


hspd = 0;
vspd = 0;

acceleration_spd = 0.02;
deacceleration_spd = 0.1;
max_spd = 3;
12 changes: 9 additions & 3 deletions objects/obj_camera_pixel_grid/Draw_64.gml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ draw_set_valign(fa_top);
draw_text_outline(1, 0, "[RMB] Zoom amount: " + string(zoom_text), _outline_width, _precision);
draw_text_outline(1, _offset * 1, "[F] camera shake", _outline_width, _precision);
draw_text_outline(1, _offset * 2, "[P] camera paused: " + (cam1.get_paused() ? "ON" : "OFF"), _outline_width, _precision);
draw_text_outline(1, _offset * 3, "[1 & 2 & 3] to switch", _outline_width, _precision);
draw_text_outline(1, _offset * 4, "between example rooms", _outline_width, _precision);
draw_text_outline(1, _offset * 3, "[B] smooth camera: " + (cam1.smooth_draw ? "ON" : "OFF"), _outline_width, _precision);
draw_text_outline(1, _offset * 4, "[1 & 2 & 3] to switch", _outline_width, _precision);
draw_text_outline(1, _offset * 5, "between example rooms", _outline_width, _precision);

//draw current camera position
draw_set_halign(fa_right);
draw_text_outline(-1, 0, $"x:{cam1.get_x()} y:{cam1.get_y()} ", _outline_width, _precision);
draw_text_outline(-1, _offset * 1, $"x_frac:{cam1.x_frac} y_frac:{cam1.y_frac} ", _outline_width, _precision);

//draw current resolution text
draw_set_halign(fa_right);
Expand All @@ -34,6 +40,6 @@ draw_text_outline(global.gui_w - 1, _offset * 3, "window mode: " + _window_mode_
var mx = cam1.room_to_gui_x(cam1.get_mouse_x());
var my = cam1.room_to_gui_y(cam1.get_mouse_y());
draw_set_halign(fa_left);
draw_text(mx,my,$"{mx} {my}");
draw_text(mx, my, $"{mx} {my}");


30 changes: 23 additions & 7 deletions objects/obj_camera_pixel_grid/Step_0.gml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

//toggle zoom in
if(mouse_check_button_pressed(mb_right)){
zoom_mode++;
Expand Down Expand Up @@ -33,6 +32,13 @@ if(keyboard_check_pressed(ord("P"))){
}
}

//toggle camera pause
if(keyboard_check_pressed(ord("B"))){
if(is_instanceof(cam1, stanncam)){
cam1.smooth_draw = !cam1.smooth_draw;
}
}

//switch resolutions
if(keyboard_check_pressed(vk_f1)){
game_res++;
Expand All @@ -56,11 +62,21 @@ if(keyboard_check_pressed(vk_f4)){
stanncam_set_window_mode(_window_mode);
}

//move camera one pixel
var _hinput = keyboard_check_pressed(vk_right) - keyboard_check_pressed(vk_left);
var _vinput = keyboard_check_pressed(vk_down) - keyboard_check_pressed(vk_up);
if(_hinput != 0 || _vinput != 0){
var _x = cam1.x + _hinput;
var _y = cam1.y + _vinput;
//move camera
var _hinput = keyboard_check(vk_right) - keyboard_check(vk_left);
var _vinput = keyboard_check(vk_down) - keyboard_check(vk_up);

if(_hinput != 0) hspd += _hinput*acceleration_spd;
else hspd -= min(abs(hspd), deacceleration_spd) * sign(hspd);

if(_vinput != 0) vspd += _vinput*acceleration_spd;
else vspd -= min(abs(vspd), deacceleration_spd) * sign(vspd);

hspd = clamp(hspd, -max_spd, max_spd);
vspd = clamp(vspd, -max_spd, max_spd);

if(hspd != 0 || vspd != 0){
var _x = cam1.x + hspd;
var _y = cam1.y + vspd;
cam1.move(_x, _y, 0);
}
2 changes: 2 additions & 0 deletions objects/obj_game_controller/Create_0.gml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
room_goto_next();

draw_set_font(f_pixel);
8 changes: 4 additions & 4 deletions objects/obj_stanncam_zone/Create_0.gml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// @description which sides to constrain
left = true;
top = true;
right = true;
bottom = true;
left = true;
top = true;
right = true;
bottom = true;

image_angle = (image_angle mod 360 + 360) mod 360;

Expand Down
29 changes: 14 additions & 15 deletions objects/obj_stanncam_zone_1side/Create_0.gml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
/// @description
event_inherited();

left = false;
top = false;
right = false;
bottom = false;
left = false;
top = false;
right = false;
bottom = false;

switch (image_angle) {
case 0:
right = true;
break;
case 90:
top = true;
break;
case 0:
right = true;
break;
case 90:
top = true;
break;
case 180:
left = true;
break;
left = true;
break;
case 270:
bottom = true;
break;
bottom = true;
break;
}
29 changes: 14 additions & 15 deletions objects/obj_stanncam_zone_2side/Create_0.gml
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
/// @description
event_inherited();

left = false;
top = false;
right = false;
bottom = false;
left = false;
top = false;
right = false;
bottom = false;

switch (image_angle) {
case 0:
right = true;
case 0:
right = true;
left = true;
break;
case 90:
top = true;
break;
case 90:
top = true;
bottom = true;
break;
break;
case 180:
right = true;
right = true;
left = true;
break;
break;
case 270:
top = true;
top = true;
bottom = true;
break;
break;
}
29 changes: 14 additions & 15 deletions objects/obj_stanncam_zone_corner/Create_0.gml
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
/// @description
event_inherited();

left = false;
top = false;
right = false;
bottom = false;
left = false;
top = false;
right = false;
bottom = false;

switch (image_angle) {
case 0:
right = true;
case 0:
right = true;
bottom = true;
break;
case 90:
top = true;
break;
case 90:
top = true;
right = true;
break;
break;
case 180:
left = true;
left = true;
top = true;
break;
break;
case 270:
bottom = true;
bottom = true;
left = true;
break;
break;
}
29 changes: 14 additions & 15 deletions objects/obj_stanncam_zone_u/Create_0.gml
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
/// @description
event_inherited();

left = true;
top = true;
right = true;
bottom = true;
left = true;
top = true;
right = true;
bottom = true;

switch (image_angle) {
case 0:
left = false;
break;
case 90:
bottom = false;
break;
case 0:
left = false;
break;
case 90:
bottom = false;
break;
case 180:
right = false;
break;
right = false;
break;
case 270:
top = false;
break;
top = false;
break;
}
Loading

0 comments on commit 0bccb4c

Please sign in to comment.