The Daily Click ::. Forums ::. Klik Coding Help ::. Collision detection around frame
 

Post Reply  Post Oekaki 
 

Posted By Message

[DELETED]

Likes to put dots on paper

Registered
  08/12/2008
Points
  118

MushroomVIP MemberARGH Sign
16th December, 2008 at 21:35:42 -

This is basically how I have set this up; there is an object the size of the screen which creates a border around the screen. It's constantly following the screen, so the player will never touch it while they walk around unless they reach the edge of the map/frame. I've also got events that will lock scrolling so the player can only move around in the screen they are in for some periods of time but not leave until they've completed a goal.

My problem is, when the player reaches the edge of the screen and a detector overlaps it, they won't stop. I'm using a custom movement, 8 directions, not built in movement. The same actions work perfectly with collidable backdrops, but they won't work with this frame.

For example;

+ Left detector is overlapping backdrop.
- Set player's X position to X("Player") + 2

This works perfectly fine.

+ Left detector is overlapping FrameDetector.
- Set player's X position to X("Player") + 2

This however, does not work at all.

Any ideas?

 
n/a

-MacAdaM-

Megaman Fosho

Registered
  12/02/2008
Points
  560
16th December, 2008 at 21:39:42 -

Go into the objects properties, and click something like "activate if off screen" or something like that. Right now i cant really think straight. hehe

 
Your just jealous that you're not as awesome as me.
(And my megaman avatar )

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
17th December, 2008 at 01:08:46 -

i'm finding it hard to understand how this works. Do you mind handing over your source so we can have a look?

 
.

[DELETED]

Likes to put dots on paper

Registered
  08/12/2008
Points
  118

MushroomVIP MemberARGH Sign
17th December, 2008 at 09:10:09 -

@MacAdaM: It's not off the screen or frame, it's constantly sitting in the frame. I did however try to change those options and it hasn't worked

@AndyUK: Sorry, I think I overcomplicated this in my first post. I'd rather not upload the source, so I will try to explain as clearly as I can with a visual aid.
Disregard what I said about screen locking, my problem is the actual collision.

Image

The red frame around the window is one large active object which follows the frame. It's a red rectangle with the middle of it transparent.

So let's say, we have walked all the way to the left of the actual level/frame, even though the red frame scrolls, when the window can not move any further at the edge of the screen it will stay put around the window.
So the character can walk to the edge but the window doesn't move or scroll to him because its as far left as it can go.

The player can now actually walk to the red frame and touch it because it doesn't move.
(Normally, as it scrolls with the window which centers on the player, he will walk and never reach it when he's in the middle of the level.)
Then the character's left collision detector overlaps this object, so I tell the player to stop. But it won't stop.

This I find weird, it works perfectly fine with backdrops with collision turned on. But not this active object?
As I wrote earlier, the coding is exactly the same yet it won't work..

Can I get this sort of system to work or what are some alternative things I could do?

Edited by [DELETED]

 
n/a

-MacAdaM-

Megaman Fosho

Registered
  12/02/2008
Points
  560
17th December, 2008 at 12:18:31 -

Hmm... Thats hard man. I have no clue, sorry.
If I come up with anything, I will Furshure post it here.

 
Your just jealous that you're not as awesome as me.
(And my megaman avatar )

traugott.simon



Registered
  23/08/2008
Points
  91
17th December, 2008 at 16:30:13 -

I dont understand why the player doesnt stop. Cant you just use the same events as touching a wall?

Nevertheless i would just create the playfield far away from the frame edges so you can never reach it.
Looks much better because scrolling stops when you come close to the frames end and everybody knows "ok heres the end of the map". very unrealistic in my opinion.

 
n/a

[DELETED]

Likes to put dots on paper

Registered
  08/12/2008
Points
  118

MushroomVIP MemberARGH Sign
18th December, 2008 at 03:10:21 -

Yeah, I really don't understand it either, I can't see any problem in my coding or as to why it doesn't work. Looks like I'll have to play around with it and find a more effective way of doing this. Thanks anyway guys!

 
n/a

Jon Lambert

Administrator
Vaporware Master

Registered
  19/12/2004
Points
  8235

VIP MemberWii OwnerTDC Chat Super UserI am an April FoolSSBB 3265-4741-0937ACCF 3051-1173-8012360 Owner
18th December, 2008 at 03:59:02 -

Try changing the virtual height and virtual width of the frame to the same as the normal dimension plus the border thickness. That way the player will go out of the frame before they touch it. Then that will be your problem.

Unless you're not using MMF2...

 
Sandwich Time!Whoo!

JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364

[DELETED]

Likes to put dots on paper

Registered
  08/12/2008
Points
  118

MushroomVIP MemberARGH Sign
19th December, 2008 at 03:00:49 -

I've figured out it was a layer problem.. but what is this virtual width and height? What purpose does it serve?

 
n/a

Jon Lambert

Administrator
Vaporware Master

Registered
  19/12/2004
Points
  8235

VIP MemberWii OwnerTDC Chat Super UserI am an April FoolSSBB 3265-4741-0937ACCF 3051-1173-8012360 Owner
19th December, 2008 at 21:01:25 -

Virtual width and virtual height lets the frame scroll beyond the play area (into the gray area in the frame editor). Using said feature is good for scrolling without making the frame larger. In this way you can do some things like have collisions outside the frame but visible in the runtime and some other stuff I wouldn't see a point in doing.

 
Sandwich Time!Whoo!

JoyCheck & KeyCheck Widgets
For easy implementation of customizable joystick and keyboard controls.
http://www.create-games.com/download.asp?id=8364
   

Post Reply



 



Advertisement

Worth A Click