Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - hankster112

Pages: 1 2
Ask a Question / Slope issues
« on: November 21, 2021, 04:43:47 pm »
Continuing from,61751.msg317666.html since it got buried.
I've figured out movement a bit better, but I still have two major issues. When traveling down a slope, the player will constantly go on/off the slope, which I assume is due to the X movement carrying the player into the air by made 1-2 pixels only to have gravity bring them back down onto the slope, repeated ad infinitum.
The other issue is that when the player reaches the top of the slope, they do a small hop before returning to normal movement. What are some ways I could go about fixing this?

Ask a Question / Re: Video files as a background
« on: November 11, 2021, 08:28:14 am »
The issue is I'd want it to scale well on all resolutions (so having several sets of images at 1080p, 1440p, 4K, etc.) and at a good framerate (60 as a minimum, 144-240 if I really want to go insane) but that would have huge performance hits as separate images.
That link might go somewhere but the repo it refers to hasn't been updated in 7-8 years, but it's better than nothing I guess.

Ask a Question / Video files as a background
« on: November 09, 2021, 06:00:16 pm »
Basically what the title says, would it would be possible to import a video file (MP4, MKV, etc.) as a background, including maintaining a parallax effect and possibly changing its resolution? I'm still working out many ideas in my head and this one seemed interesting. The few threads I've seen on it recommend exporting the video as individual frames, however that seems like a waste of performance and I wanted to check if there was a better way of doing so.

Ask a Question / Re: Normalizing movement on slopes
« on: November 09, 2021, 05:50:19 pm »
I've simplified my ground check like you posted and worked out most of the kinks, however I'm still having some issues. The player still comes to a stop at a 45 degree slope and traveling down a 30 degree slope causes the ground check to rapidly switch between true/false.

Edit: Messed around with friction and speed a bit more and I'm figuring out how to use tile data to change movement speed. However now whenever the player goes up a slope and reaches the top, they do a small hop. How would I mitigate this?

Ask a Question / Re: Normalizing movement on slopes
« on: October 27, 2021, 03:33:26 pm »
The ground check system I have checks for:
  • Player's y-speed is 0
  • Player is not actively jumping
  • Player is not grabbing onto a ledge
If any of these conditions are not met, it sets PlayerOnGround to false. Should I be checking for anything else?

Ask a Question / Normalizing movement on slopes
« on: October 26, 2021, 06:47:48 pm »
I've developed a movement system for a 2D Metroidvania that up until now has worked fairly well. However I was only testing it on flat surfaces, and now that I have remembered that sloped tiles exist it's thrown everything out of whack. When trying to walk up a slope, the player's movement is reduced to a crawl and they will slide back down if the button is released. The movement system in this game was built from the ground up (no extensions/starter packs) and probably has a lot of inherent flaws that need to be worked out. Would anyone be able to give me some pointers in the right direction? I can post specific segments/explain other parts if needed.

The hitbox for that animation ended up being one pixel too tall and that was somehow throwing the engine completely off. Computers are weird. Thank you!

Normally, the hitbox around the player characters stays just that, around the player in a single box. However, when switching to certain animations (specifically when jumping and aiming to the left), the hitbox is placed at a fixed location away from the player (attached image). Any ideas what could be causing this?

Ask a Question / Re: Raycasting Help
« on: January 30, 2021, 09:32:54 am »
It has something to do with checking that item 1 in the list is a member of the tiles group. It runs fine without it, albeit still incorrectly (it's draws a small dot that's completely off on the player's position).

Ask a Question / Re: Raycasting Help
« on: January 28, 2021, 07:59:32 pm »
The major difference between your code and mine is that your raycast is based off a static entity, whereas mine is being done from a constantly moving one, the player. The static values you have set for x2 and y2 don't work in my case. Trying to run what I believe is the corrected variation of your code crashes instantly.
To elaborate what I am trying to do, I need the game to constantly be checking where the player is pointing and marking the x and y coordinates of the first object in the player's line of sight, be it tiles or actors. As another side note, I am having issues trying to figure out the coordinates that should be entered if the player is looking at a 45 degree angle, as the x and y location of the line would be different from a simple check of the scene's height/width. If that's too much of an issue for this thread I'll make a separate one for it.

Ask a Question / Re: Raycasting Help
« on: January 27, 2021, 04:19:33 pm »
I'll bump this thread one last time, I'm not finding any solutions and the answers provided by merrak did not solve the issue.

Ask a Question / Re: Raycasting Help
« on: January 18, 2021, 04:16:22 pm »
I could still use some help on this, I'm completely lost.

Ask a Question / Re: Raycasting Help
« on: January 17, 2021, 01:29:11 pm »
The camera for the scene in question is static; that shouldn't be affecting anything in this instance.

Ask a Question / Re: Raycasting Help
« on: January 17, 2021, 11:40:56 am »
I believe I'm formatting that equation correctly, but it still isn't doing what it's supposed to. The line still stops at random points (albeit different ones from before) and still travels through the same tiles.

Ask a Question / Re: Raycasting Help
« on: January 17, 2021, 07:00:44 am »
Tiles can be tricky to work with because the individual collision bounds of tiles are merged into larger polygons. Turn on debug draw to see where these are. There is a parameter you can use to compute the position where the collision occurs along the line segment from the origin to the end. I don't remember off the top of my head what that is. Do you have documentation for the extension?
It's not much but yes. The block I'm using is the last one he describes.
This extension provides three blocks:

1. "first actor on line" returns the first actor hit on the line (the actor nearest to x1, y1). If no actor is hit, it will return null.

2. "all actors on line" returns a list of all actors hit on the line, in order of first hit to last hit.

3. "ray cast" returns a list of raycast results, in order of first hit to last hit. Each result is its own list containing:
   0. The B2Fixture hit.
   1. The actor the fixture belongs to.
   2. The x of the collision.
   3. The y of the collision.
   4. The x normal of the collision.
   5. The y normal of the collision.
   6. The fraction along the line at which the collision occured.

Pages: 1 2