How do I correctly use touch/mouse movements for main Sprite

Get help using Construct 2

Post » Thu Jan 15, 2015 4:42 am

I am not sure how to explain it, but pretty much the way I am controlling the sprite is with mouse or by touch(THIS IS NOT THE PROBLEM) (I know how to implement them both). The PROBLEM: When I use these methods the main sprite goes through the boundaries.
For example, I am making a maze game. I want to control my main sprite with mouse or through touch. When I use these methods the sprite goes through my boundary blocks that make up the maze itself. My question is how do I make the main character sprite either bounce off or not go through the blocks that make up my maze, while using touch/mouse features. To further give you detail, in a maze you don't go through it, you are supposed to find your way out by finding a path in the maze. If I can get this done, that would be detrimental to what I am building. Please if you know how to solve this it would be greatly appreciated!
B
4
Posts: 4
Reputation: 210

Post » Thu Jan 15, 2015 5:27 am

Does your Player Sprite have any or all of these Behaviors:
- Bound to Layout
- Solid
- 8-Direction
Do your boundary blocks have the Solid attribute?
B
11
S
4
Posts: 152
Reputation: 1,236

Post » Thu Jan 15, 2015 6:26 am

Yes, they both have 'solid' on. The main character, the guy that you control has 'bound to layout' so he doesn't go out or bounds outside of the whole level. That's the weird thing, I would expect since the boundary blocks that make up the trail for the maze are solid and the character is set to solid that the character wouldn't go through them, but somehow they still do. If you need anymore info, let me know. I've done the usual stuff that are needed, maybe there is a function that i am not aware about?
B
4
Posts: 4
Reputation: 210

Post » Thu Jan 15, 2015 6:28 am

@umajoe a capx-file would be very useful...
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Thu Jan 15, 2015 8:27 am

Okay: Solid objects can totally overlap. What behaviors are you using to control the character?
Or are you using, like, "on tap move character towards tap position"
B
11
S
4
Posts: 152
Reputation: 1,236

Post » Thu Jan 15, 2015 7:25 pm

Touch and Mouse enabled
boundary blocks/character set to solid
character- bound to layout, Scroll-to,
Touch-Is in Touch- Sprite(Main Character)- Move- Angle:Self.X,Self.Y, Touch.X, Touch.Y) Distance:300 * dt
This is what I have for the Event sheet, nothing more, just the movement code. I'm sorry I don't know how to put the capx file in here so I just wrote out the event sheet...
I want to solely move the Main Character(sprite) in between the boundaries that make up the maze through touch or mouse movement. The way I have configured the movement through the code is more or less the way I want the movement to be(pretty smooth) I have a touch screen so I can test out the touch movements. It seems no matter what I try I still can't get the Main sprite to stop going through the boundary blocks. Tried setting him as a platformer but nothing.
Let me know, thanks!
B
4
Posts: 4
Reputation: 210

Post » Thu Jan 15, 2015 8:24 pm

Well, for reference you upload the .capx file by saving as a .capx, then clicking the "Upload attachment" tab at the bottom of the reply box (needs full editor,) then select that .capx file. (as I have done below)

I think if you're using a custom movement like that, your best best is to use the Physics behavior.
Give both player and walls Physics. Set Walls to immovable and Prevent Rotation to yes. Set Player to Prevent Rotation.
Very important, however, is to set World Gravity to 0 at the beginning of the layout, or else your player will always fall down.
You do not have the required permissions to view the files attached to this post.
B
11
S
4
Posts: 152
Reputation: 1,236

Post » Thu Jan 15, 2015 11:07 pm

Unnatural, I appreciate your consistent help. I think instead of what I am trying to do I am going to implement PacMan style controls from a tutorial that they have here. I'll give you a heads up when I am near completion! Thanks!
B
4
Posts: 4
Reputation: 210


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], Malhog and 12 guests