Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Stranga on Mon 21/10/2019 02:55:15

Title: Side-scrolling Adventure Game help [SOLVED]
Post by: Stranga on Mon 21/10/2019 02:55:15
Hello everyone,

I would like to know if there is a better way of implimenting a side-scrolling adventure game. I am currently developing one and I've noticed the system I'm using is a little jarring. The character walks left and right fine, but when inspecting a hotspot/region/object he lift/drops a pixel or two above or below the ground rather than stay on the ground (if it is making sense)

Screen: Here is how the game looks.
Spoiler

[imgzoom]https://i.imgur.com/sXCpNQu.png[/imgzoom]

Here is how I'm currently making the walking method.
[imgzoom]https://i.imgur.com/SMjupWg.png[/imgzoom]
[close]

I'm also using keyboard controls only, since I want to port my games to consoles in the near future.

Any help will be greatly appreciated, thank you all!
Title: Re: Side-scrolling Adventure Game help
Post by: Khris on Mon 21/10/2019 08:41:12
Are you using the Keyboard Module?
Have you found out why they move down a pixel? Are you using WalkTo points for hotspots? How do you trigger interacting with a hotspot?
Title: Re: Side-scrolling Adventure Game help
Post by: eri0o on Mon 21/10/2019 13:57:50
Hey Stranga, I have open sourced some stuff which may or may not be relevant to you, so I will leave them below in case anything is useful.

An open source game using same approach for 2D sidescroller: Hell's Puppy  (https://www.adventuregamestudio.co.uk/forums/index.php?topic=56851.0)

Alternative Keyboard/Joystick control to Khris Keyboard Module :  Controlz (https://www.adventuregamestudio.co.uk/forums/index.php?topic=57427.0)

Realistic 2D physics, has a small demo for sidescroller with keyboard control:  AgsBox2D  (https://www.adventuregamestudio.co.uk/forums/index.php?topic=57458.0)

A simple arcady platformer, not the focus of the code but may be useful: rellax module demo (https://www.adventuregamestudio.co.uk/forums/index.php?topic=57489.0)

Title: Re: Side-scrolling Adventure Game help
Post by: Stranga on Tue 22/10/2019 13:53:24
@Khris I am using a keyboard module but I think the problem lies within the room editor's WalksToPoint before the hotspot triggers. I don't necessarily need it, but it's just nice to position the player without having to add the WalksToPoint in the room's script. But to get it to work without the pixel jump up/down it has to be exactly on the y.position of the player. This becomes tedious, especially on levels with a tall room.

@eri0o Thanks for sharing some ideas. I do like the rellax module! Trying the demo now.
Title: Re: Side-scrolling Adventure Game help
Post by: Cassiebsg on Tue 22/10/2019 18:44:38
In script you can just use player.y instead of the the actual y.  ;) This would of course mean you need to drop the room editor's WalksToPoints.

If typing player.Walk(x, player.y, and so on) is too much. You could just write a small function, so that you could do:

Walk(70); (where 70 is the x)
or
Walk(spot); (this would be a string).

The function could then look like:

function Walk(int spotX)
{
  player.Walk(spotX, player.Y, eBlock, eWalkableAreas);
}
Title: Re: Side-scrolling Adventure Game help
Post by: Stranga on Wed 23/10/2019 00:24:17
That's actually not a bad idea @Cassiebsg! I'll give that a try :-D