The following warnings occurred:
Warning [2] unserialize(): Error at offset 1251 of 1260 bytes - Line: 2650 - File: inc/functions.php PHP 8.3.36 (Linux)
File Line Function
/inc/class_error.php 157 errorHandler->error
[PHP] errorHandler->error_callback
/inc/functions.php 2650 unserialize
/inc/class_datacache.php 138 native_unserialize
/inc/init.php 182 datacache->cache
/global.php 20 require_once
/printthread.php 16 require_once



MFGG Forums
(trash, do not read) - Printable Version

+- MFGG Forums (https://forums.mfgg.net)
+-- Forum: MFGG (https://forums.mfgg.net/forumdisplay.php?fid=4)
+--- Forum: Developer Discussion (https://forums.mfgg.net/forumdisplay.php?fid=10)
+--- Thread: (trash, do not read) (/showthread.php?tid=689)



(trash, do not read) - mrpin355 - 03-31-2018

While this thread is active.

I got a issue dealing with Wiggler's body parts, and I seriously want help, the fact that I tried many methods but it won't work and "Developer Discussion" is the least active thread of this site.

The problem is that whenever it instantly moves horizontally 8 pixels, specifically, shifting itself while on the slopes it jumps *number depending how steep the slopes is* pixels up,
I know why that happens, but I need a better method that solves this problem.

Here is a screenshot visually portraying it:
[Image: issue.png]
Wiggler is flashing


Thanks.


RE: Wiggler's body parts on slopes - Willsaber - 04-02-2018

Some more information would help in diagnosing the issue. What kind of collision checking are you using?


RE: Wiggler's body parts on slopes - mrpin355 - 04-02-2018

(04-02-2018, 12:49 AM)Willsaber Wrote: Some more information would help in diagnosing the issue. What kind of collision checking are you using?

I use collision_rectangle for these situations.


RE: Wiggler's body parts on slopes - Hyper - 04-02-2018

Please post your codes here using
Code:
[code]//code here[ / code] (remove the spaces between "/")



RE: Wiggler's body parts on slopes - mrpin355 - 04-02-2018

Before reading the code, It's a modified Hello's Wiggler object.
I might hear I should make my own.

Stun code
Code:
//Stop body parts for (i=0; i<maxpart; i++) { //Affect parts animation with (part[i]) { //Freeze image_speed = 0; hspeed = 0; //Stop turn sequence timerstart = 0; //Snap the parts x = behind.x-offset*xscale; //Turn him into a "accordion"! offset = 3; }

Slope logic
Code:
//Embed into the slope to ensure correct slope mechanics if (collision_rectangle(bbox_left,bbox_bottom,bbox_right,bbox_bottom+4,obj_slopeparent,1,0)) and (!collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom-4,obj_slopeparent,1,0)) and (vspeed = 0) y += 4; ///Handle slope collisions if (collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom,obj_slopeparent,1,0)) && (!collision_rectangle(bbox_left,bbox_bottom-8,bbox_right,bbox_bottom-8,obj_slopeparent,1,0)) { //Stay embed on the slope. while collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom,obj_slopeparent,1,0) y--; }

When spawned
Code:
//Create anatomy part[0] = instance_create(x,y,obj_wiggler_body) { part[0].image_index = 0; part[0].depth = -1 part[0].parent = id; part[0].behind = other.id; //Snaps to the head } part[1] = instance_create(x,y,obj_wiggler_body) { part[1].image_index = 1; part[1].depth = 0 part[1].behind = part[0];//Snaps to the previous body and so on. part[1].parent = id; } part[2] = instance_create(x,y,obj_wiggler_body) { part[2].image_index = 2; part[2].depth = 1 part[2].behind = part[1]; part[2].parent = id; } part[3] = instance_create(x,y,obj_wiggler_body) { part[3].image_index = 3; part[3].depth = 2 part[3].behind = part[2]; part[3].parent = id; }

If you need more, let me know.

Anyone here?


RE: Wiggler's body parts on slopes - mrpin355 - 04-06-2018

If the screenshot is not enough.

Here is a .gif showing it on action!
[Image: image.gif]


RE: Wiggler's body parts on slopes - Hyper - 04-07-2018

Comment out this in the stun code:
Code:
x = behind.x-offset*xscale;



RE: Wiggler's body parts on slopes - mrpin355 - 04-07-2018

(04-07-2018, 03:15 PM)Hypernova Wrote: Comment out this in the stun code:
Code:
x = behind.x-offset*xscale;

It makes the body part snap to it's assigned behind body parts.
Functions purpose is when it's stunned or when it makes a turn.
'offset' means the width of the body.


RE: Wiggler's body parts on slopes - Hyper - 04-07-2018

You intended to make the Wiggler to shorten itself when hit, however the y position is not set during the processes. I would recommend to do this:

Instead of:
Code:
//Snap the parts x = behind.x-offset*xscale; //Turn him into a "accordion"! offset = 3;

Do this
Code:
//Turn him into a "accordion"! offset = 3; //Snap the parts x = behind.x-offset*xscale; if (collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom,obj_slopeparent,1,0)) { do { y--; } until !(collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom-1,obj_slopeparent,1,0)) } else { do { y++; } until (collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom,obj_slopeparent,1,0)) }



RE: Wiggler's body parts on slopes - mrpin355 - 04-07-2018

(04-07-2018, 10:19 PM)Hypernova Wrote: Do this
Code:
//Turn him into a "accordion"! offset = 3; //Snap the parts x = behind.x-offset*xscale; if (collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom,obj_slopeparent,1,0)) { do { y--; } until !(collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom-1,obj_slopeparent,1,0)) } else { do { y++; } until (collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom,obj_slopeparent,1,0)) }

Thanks, but for some reason GameMaker reads it as 'Unexpected symbol'.


RE: Wiggler's body parts on slopes - Hyper - 04-07-2018

Are you using Game Maker 8, Studio, or Studio 2? Is there a reference that points out the unexpected code error?


RE: Wiggler's body parts on slopes - mrpin355 - 04-07-2018

(04-07-2018, 11:38 PM)Hypernova Wrote: Are you using Game Maker 8, Studio, or Studio 2? Is there a reference that points out the unexpected code error?
I'm using Studio 1.4 and it doesn't point out why.


RE: Wiggler's body parts on slopes - Hyper - 04-07-2018

Let's see if this helps:

Change this:
Code:
until !(collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom-1,obj_slopeparent,1,0))

To this:
Code:
until (!collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom-1,obj_slopeparent,1,0))



RE: Wiggler's body parts on slopes - mrpin355 - 04-08-2018

(04-07-2018, 11:48 PM)Hypernova Wrote: Let's see if this helps:

Change this:
Code:
until !(collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom-1,obj_slopeparent,1,0))

To this:
Code:
until (!collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom-1,obj_slopeparent,1,0))


[Image: image.png]
Unfortunately, it still doesn't work.
I recommend you test it before you publish the code.
If you want, I could PM and give you the object and diagnose it.


RE: Wiggler's body parts on slopes - Hyper - 04-08-2018

I am currently using Game Maker: Studio 1.4.1804. I have tested out the code without any issues:
[Image: Test_Dolphin.png]

Some older version of Game Maker Studio may have issues like this, please update the game engine and see if that helps.

My end of result:
Reference of do/until statement:
https://docs.yoyogames.com/source/dadiospice/002_reference/001_gml%20language%20overview/401_10_do.html


RE: Wiggler's body parts on slopes - mrpin355 - 04-08-2018

(04-08-2018, 12:38 AM)Hypernova Wrote: I am currently using Game Maker: Studio 1.4.1804. I have tested out the code without any issues:
[Image: Test_Dolphin.png]

Some older version of Game Maker Studio may have issues like this, please update the game engine and see if that helps.

My end of result:
Reference of do/until statement:
https://docs.yoyogames.com/source/dadiospice/002_reference/001_gml%20language%20overview/401_10_do.html
I'm using 1.4.1804 as well.
Wtf is going on?
Like, did I accidentally do a minor change?


RE: Wiggler's body parts on slopes - Hyper - 04-08-2018

Clear its compiler cache and restart the program would be a typical solution in most cases.


RE: Wiggler's body parts on slopes - mrpin355 - 04-08-2018

N/A

(04-08-2018, 12:50 AM)Hypernova Wrote: Clear its compiler cache and restart the program would be a typical solution in most cases.

Sorry for annoying you, but this time the problem is fixed!

Thanks for helping!
Topic disclosed.


for now...


RE: Wiggler's body parts on slopes - Hyper - 04-08-2018

Since I am not able to DM you (Error message: Existant has private messaging disabled. You cannot send private messages to this user.), I'll just post an alternative solution here:

Code:
if (collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom,obj_slopeparent,1,0)) { do { y--; } until !(collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom-1,obj_slopeparent,1,0)) } else if (collision_rectangle(bbox_left,bbox_bottom+1,bbox_right,other.bbox_bottom+32,obj_slopeparent,1,0)) { do { y++; } until (collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom,obj_slopeparent,1,0)) }



RE: Wiggler's body parts on slopes - mrpin355 - 04-08-2018

(04-08-2018, 02:34 AM)Hypernova Wrote: Since I am not able to DM you (Error message: Existant has private messaging disabled. You cannot send private messages to this user.), I'll just post an alternative solution here:

Code:
if (collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom,obj_slopeparent,1,0)) { do { y--; } until !(collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom-1,obj_slopeparent,1,0)) } else if (collision_rectangle(bbox_left,bbox_bottom+1,bbox_right,other.bbox_bottom+32,obj_slopeparent,1,0)) { do { y++; } until (collision_rectangle(bbox_left,bbox_bottom-4,bbox_right,bbox_bottom,obj_slopeparent,1,0)) }

And this time it worked!
Thanks for your big help!
I was trying to fix that problem like in 2 months!