Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / creating a side scroller with SetSpritePhysicsVelocity

Author
Message
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 5th Oct 2021 22:08 Edited at: 10th Oct 2021 13:31
So I am creating a side scroller and am making a master question thread as asked.

It is a mario like platform that is going good and looking just like super mario.

So I will post all my questions here and hope to show some progress.

Attachments

Login to view attachments
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 6th Oct 2021 02:09 Edited at: 6th Oct 2021 02:12
do you have any gameplay footage? i know you've been working on this for a bit and wondering how playable it is at this point?

otherwise, its looking good. keep at it
[My Itch.io Home] [AGK on Itch.io]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 6th Oct 2021 02:16


I do not just yet but will make some today just to show you.

You have been helping me a lot and deserve to see some game play.

It has been a learning experience.

Thank you a lot.
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 6th Oct 2021 04:44
I updated the first post with a little video of the first level. could not put in in the thread there.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 6th Oct 2021 05:05 Edited at: 6th Oct 2021 05:16
very cool. its coming along well.

remember this? some of your shapes need to be adjusted.

and, thanks for the vid

btw, now that you've joined this discord, i've changed the moving platofrms to kinematic and it works much better (not sure how you're doing it), and i've added a swing i don't remember if i've shown the ladder here, either.
[My Itch.io Home] [AGK on Itch.io]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 6th Oct 2021 06:22

Yes, I adjusted the shape to poly but need to adjust the static platform stuff, thanks.

I looked at the discord and would want the update for the swing to see how it works, that would be so cool.

I'm using dynamic with the CreatePrismaticJoint

But I'm learning a lot



Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 6th Oct 2021 12:07 Edited at: 6th Oct 2021 12:16
Quote: "the swing"

that's just a distance joint connecting the swing platform to the base sprite above it.

try it with a rope joint, too. the effect is similar (more like a real swing connected with a rope or chain):

see the difference?
[My Itch.io Home] [AGK on Itch.io]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]

Attachments

Login to view attachments
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 6th Oct 2021 20:30 Edited at: 6th Oct 2021 20:34
Ill try it today, It looks promising.

I have a event I set up where when you stand beside a mushroom and stand on top of it then press up it grows with you on top of it , what I need is for the player to climb it to the sky.

it look very cool , but I'm sure all I have to do is increase the players y with SetSpritePhysicsImpulse while collision .

I'm so upset now because I don't have the animations on my players sprit sheet for all my ideas .lol.

edit:

CreateRopeJoint( iSpriteIndex1, iSpriteIndex2, x, y, x2, y2, maxLength, colConnected )

Wow, I'm so loving these commands I knew nothing about.
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 10th Oct 2021 00:50
Here is the problem

I am hitting each rock to produce a coin, each rock has so many coins

I need for one coin to come out of the array at a time till all coins are finished or=0

But no matter what I write all coins come out, not only that 199 coins are created, help.

hitting the rock



creating the coins



the array holding each rocks coin amount

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 10th Oct 2021 03:22 Edited at: 10th Oct 2021 03:36
this should get you going:


if you're doing a typical coin-spewing rock, you'll prolly want to make sure the contact made was with the player's head/upper body in order to spawn but i'll leave that up to you.
[My Itch.io Home] [AGK on Itch.io]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]

Attachments

Login to view attachments
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 10th Oct 2021 06:01
Virtual Nomad

It so funny but that is exactly what I was hoping for

I will just have to look at your code and learn more from it.

I'm smiling right now.
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 10th Oct 2021 13:21 Edited at: 10th Oct 2021 13:21
Here is a big update

Lots more to do

Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 13th Oct 2021 17:00
I feel like the gravity needs increased.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 14th Oct 2021 01:00
Quote: "I feel like the gravity needs increased."


Ok, Yea I can see this to.

This is what I'm doing, I am adding more gravity at a certain height, I'm working it out, hopefully I can find a even ground on it.

PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 14th Oct 2021 01:52
Why are you adjusting the gravity, thats not how physics works gravity is a constant force, increase the players mass and decrease the dampening and he will fall faster, no need to be adjusting gravity on the fly like that let the physics engine work, Box2D is setup to use real world scaling factors so set real world parameters, you seem to be fighting against how Box2D wants to work, in a physics engine you set your parameters and the engine does the rest changing things mid loop like that is just going to mess up the physics simulation and you'll never get decent results.
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 14th Oct 2021 02:01
Quote: "increase the players mass "

Does mass affect the rate of fall?
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 14th Oct 2021 02:28
Quote: "increase the players mass and decrease the dampening and he will fall faster"


OK, Good idea and your right, I will try this.

But to be honest it has not given me any problems at all.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 14th Oct 2021 03:05 Edited at: 14th Oct 2021 03:24
Quote: "it has not given me any problems"

then don't change it. what you're doing is providing some effect that you're happy with.

i can imagine some Matrixâ„¢ slo-mo effects using various gravity values, etc, so, in the end, if you're happy with it, stick with it,

Quote: "decrease the dampening and he will fall faster"

...it's going to affect a lot more that "falling".
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 14th Oct 2021 03:32 Edited at: 14th Oct 2021 03:33
Well I looked into a lot of fall speed and remembered we are using SetSpritePhysicsVelocity so what I did was set it on a jump timer.

it works about the same way.

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 14th Oct 2021 03:45 Edited at: 14th Oct 2021 03:49
all i'm saying is, newton might have been wrong.

google says he was "a genius with dark secrets". maybe he just discovered a way to keep us all down

diabolical!
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 14th Oct 2021 03:55
Quote: "google says he was "a genius with dark secrets". maybe he just discovered a way to keep us all down "


lol, that video is fun to watch.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 14th Oct 2021 03:57
What about Galileo?
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 14th Oct 2021 04:07 Edited at: 14th Oct 2021 04:10
Quote: "What about Galileo?"


All he did was drop weights off a tower, I have done this experiment myself and found a feather that is light has wind resistance, there are many other problems to gravity we don't think about.

That feather was falling very slow drifting in the wind and the shoes fell very fast.
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 14th Oct 2021 07:29 Edited at: 14th Oct 2021 08:24
Get saved files names and printing them to screen?

I am saving my players games with there names



Now I need to read all the saved files and print them to screen so my players can choose what save point they want to use.


this is what I'm trying but I can not convert the sting to a text

PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 14th Oct 2021 12:24
Quote: "All he did was drop weights off a tower"


That's not exactly true, I love how history gets contorted and falsely becomes fact, that was written in a book some 15 years after his death by a fanboy that was know to be a little conservative with the truth about Galileo research, the man himself made no records of such an experiment ...

Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 14th Oct 2021 12:34
Quote: " the man himself made no records of such an experiment"


I'm not sure definitely what he did, I just made a joke about it lol.

anything on my last post?

Printing multiple lines of stings can be done, but text holds only one values and can only display one sting?
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 14th Oct 2021 12:58
change

line3$ = "Saved Game=" +Get

to

line3$ = line3$ + "Saved Game=" +Get

and move SetTextString ( Player_save_text, line3$ ) outside the loop (after the loop)

this builds the string in the loop and sets it when done

but if you want the user to be able to select separate lines then maybe the glaringly obvious solution is to use more text objects.
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 15th Oct 2021 01:29
PartTimeCoder

That didn't work, but what I am doing is if you type your name if there is a saved file it shows you that one saved file.

this should be fine.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 15th Oct 2021 05:58 Edited at: 15th Oct 2021 06:04
confused.

so, there are player folders? and each player folder can have multiple .dat files in it for that player that (only?) hold check points in them? no scores, etc?

regardless, why not 1 player file with everything about the player in it?

either way, maybe explain what you're looking for better (structure, file names, etc) and we'll go from there?

also, some of those file commands aren't gonna work in html or other platforms so you only expect to publish/share this for desktop?
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 15th Oct 2021 07:48
No, Everything like, If there name matches then there saved games = there names.

So then there saved games load to there matched names.

I am planning on releasing this on pc and phones.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 16th Oct 2021 16:13 Edited at: 17th Oct 2021 00:01
i'm still unsure of what you're looking for but this might help:

note, on many platforms, filenames are case-sensitive (or only allow lower case). hence, not using the actual player names (which may allow upper case) as filenames. you can use all LOWER and just make the first character UPPER as some games do but that's up to you.

aside:

WriteString() appears to be broken; the .dat files generated are definitely human readable (and hackable). issue added to the repo: 893

update: apparently the above is expected behavior (i remember otherwise but not the first time memory has failed me :/ )

Attachments

Login to view attachments
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 17th Oct 2021 19:08
Quote: "All he did was drop weights off a tower, I have done this experiment myself and found a feather that is light has wind resistance, there are many other problems to gravity we don't think about.

That feather was falling very slow drifting in the wind and the shoes fell very fast"


That's why the experiment is now tested in a vacuum, to remove wind resistance from the equation.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 17th Oct 2021 21:17
Well a update

I added two videos as I cant combine them

I added climbing and shooting and a lot more.

lots more to do.




Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 17th Oct 2021 21:39 Edited at: 17th Oct 2021 21:47
nice update.

how are you navigating slopes? i've tried adding SIN/-COS of the angle (*Velocity) but the movement isn't smooth (i think i've countered gravity there, as well); it seems to "dig in" to the slope(and sometimes pass through the object). that was my first take so exploring options.

otherwise, it looks like you're re-sizing animation frames where certain animations seem to shrink the player/enemies to "make it fit"? instead of re-sizing to specific dimensions (which i assume you're doing), maybe scale all the images to the same scale?

btw, i like how the music sets the tone/pace of the game between this latest update (more methodical, exploratory play) and previous vids (general fun, free-for-all).

keep it up
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 17th Oct 2021 23:17
Virtual Nomad

Thank you,

Quote: "how are you navigating slopes?"


By adding my own shapes for collision point by point, after the first one I just copy that and add more shapes where needed.

Quote: " re-sizing animation frames "


That my ducking, I do resize the player while the player ducks because in the animation there is no difference in size. I'm still working that out lol.

Quote: "i like how the music sets the tone"


I am trying to find as much zone out music I can that is royalty free.

Thank you for all your help and teaching me what I need.
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 18th Oct 2021 00:23
Quote: "I'm still working that out lol."


Using sprites with differing animation frame sizes is a bit of a pain, the obvious solution is to pack them all into s single sheet with all the frame sizes the same size but that just waists tonnes of transparent pixels in my opinion, a good work around is to take a GameMaker approach and treat your player as an independent object and the animations as separate sprites, you do your physics operations on the main object and have the animation sprites follow it, set the offset for all sprites to bottom center and when you show the animation sprites all there centers match and should look smooth, else you have to resize the sprite and adjust its position every time you change animation.

The game is coming on, well done
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 18th Oct 2021 01:01
PartTimeCoder

Quote: "Using sprites with differing animation frame sizes is a bit of a pain,"


Well I am using two sprite sheets for each player, the Guy or Girl. they all have the same sprite size in every frame and this is why I need to shrink my player down a but for crouching.

Quote: " animations as separate sprites"


I will look into this as a back up plan as each sprite sheet for my player sprite are almost 5 mg a piece with 50 frames.

Thank you for your ideas and for your help.
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 18th Oct 2021 16:13
I am trying to create a rope joint

Now I am setting my rope at the offset and it joins them together but

the points are at 0 pos

here is my test code



PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 18th Oct 2021 16:29
Use world coordinates

Quote: "Creates a rope joint between two sprites. The rope joint enforces a maximum distance between the sprites without any other restrictions. It does not stop them getting closer together. Specify two anchor points in world coordinates with the maximum length you want to allow, the current position of the sprites does not affect the initialisation of the joint. The anchor points can be offset from the sprite positions. A joint may be deleted by the system if any of the sprites it connects are deleted."
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 18th Oct 2021 17:01 Edited at: 18th Oct 2021 17:13
Well I changed it to world and still does not work correctly, doing the same thing.



EDIT

I looked in the examples and there is a different way to use a rope and it works welll.

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 18th Oct 2021 17:42 Edited at: 18th Oct 2021 17:47
you're getting the sprite Offset(s) when you mean GetSpriteX/YByOffset

click the boxes
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 18th Oct 2021 18:20
Virtual Nomad

Thanks, I will look at it and learn from it.


Great example by the way.

Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 18th Oct 2021 18:35
How do I se my players angle to match the swing?

I set my sprite player not to rotate so im hoping my player can have its angle set to.
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 18th Oct 2021 20:14
Quote: "How do I se my players angle to match the swing?"

what have you tried so far?
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 18th Oct 2021 20:37 Edited at: 18th Oct 2021 20:48
Quote: "what have you tried so far?"


This works good but when I get off the swing my angle is all messed up.



I tryed this but it maes my player shake back and forth

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 18th Oct 2021 21:02 Edited at: 18th Oct 2021 21:11
Quote: "when I get off the swing my angle is all messed up."
set it to whatever when you get off the swing.

Quote: "player shake back and forth"
it seems its getting on/off/on again (over and over).

if you put a timer() between getting off and when it can get back on again, it could help.

if you make it a selectable action (getting on/off the rope using a button, for example), that would solve as well but you need to make a rule/trigger, somehow.

then,

is going to constantly set the angle to 0 when not colliding with rope_2. if you leave that "as is", forget about changing angles anywhere else.

meanwhile, if you haven't already implemented sprite groups, the further you get into adding various elements, the more obvious the need will become.
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 19th Oct 2021 02:27 Edited at: 19th Oct 2021 02:47
Virtual Nomad

I was thinking about setting a distance and if im not in that distance my angle will reset.

Ill let you know if this works.

And yes, I am using sprite groups to filter bullets and other things like coins.

I am very surprised at how much code this game has already lol/

but in the old days they used millions of lines of coding.


Edit:::

This works good here

Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 19th Oct 2021 21:46
scrolling sprite

Ok so i decided to play around with scrolling my background instead of loading 70 back ground sprites and I don't like the effect.

it looks real bad.

I need the background to scroll at my players speed only if my player is moving, sometimes my player gets stuck even if the button is pushed or joystick.

So somehow I need to figure out how to scroll my background at my player speed.

this is what I am doing and it well, not so good.



PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 19th Oct 2021 23:13
I think .... player x / screen width, use Mod to get the remainder and thats your offset
Open Source plugins
Cl - DnD Plugin
Buy Me A Coffee
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 19th Oct 2021 23:45
PartTimeCoder

I divide my screen width to my Player x to get a speed?

I'm a little confused here sorry.

All I need is a good way to scroll my background to my player speed and only if they are moving.

Login to post a reply

Server time is: 2024-03-28 20:36:39
Your offset time is: 2024-03-28 20:36:39