Posted: 14th Oct 2021 3:55
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.
Posted: 14th Oct 2021 3:57
What about Galileo?
Posted: 14th Oct 2021 4:07
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.
Posted: 14th Oct 2021 7:29
Get saved files names and printing them to screen?

I am saving my players games with there names

+ Code Snippet
function Save_last_Player()
// write data to a file
//SetRawWritePath( "C:\Users\Public\Documents" )
OpenToWrite ( 1, "player.dat", 0 )

A$=Name$

WriteString  ( 1, a$ )

CloseFile ( 1 )

endfunction


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

+ Code Snippet
path as string
path = GetWritePath()+"media"
folderID = OpenRawFolder( path )
folderCount = GetRawFolderNumFolders(folderID)
fileCount = GetRawFolderNumFiles(folderID)

do
	
		for i = 0 to fileCount-1
			
		//Print( "    " + GetRawFolderFileName(folderID,i) )

		get$=GetRawFolderFileName(folderID,i) 

		SetTextString ( Player_save_text, line3$ )

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

sync
loop
Posted: 14th Oct 2021 12:24
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 ...
Posted: 14th Oct 2021 12:34
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?
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.
Posted: 15th Oct 2021 1: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.
Posted: 15th Oct 2021 5:58
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?
Posted: 15th Oct 2021 7: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.
Posted: 16th Oct 2021 16:13
i'm still unsure of what you're looking for but this might help:
+ Code Snippet
// Project: players 
// Created: 2021-10-14
// By: Virtual Nomad
// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "players" )
SetWindowSize( 1280,720, 0 )
SetWindowAllowResize( 1 )

// set display properties
SetVirtualResolution( 1280,720)
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 ) 
SetScissor( 0,0,0,0 )
UseNewDefaultFonts( 1 ) 


Type SaveData
	PlayerName$, Checkpoint, Score
EndType

GLOBAL Saves as SaveData []

GenerateSaves()

LoadSaves()

GLOBAL CurrentPlayer as SaveData
PickPlayer()

do

	CheckESC()
   

    Print( "Player: " + CurrentPlayer.PlayerName$ )
    Print( "Checkpoint: " + STR(CurrentPlayer.Checkpoint))
    Print( "Score: " + STR(CurrentPlayer.Score))
    Sync()
loop

Function PickPlayer()
	TotalSaves = Saves.Length
	If TotalSaves > -1
		TempTextIDs as Integer []
		For x = 0 to TotalSaves
			ThisText = CreateText(Saves[x].PlayerName$)
			SetTextSize(ThisText,36)
			SetTextPosition(ThisText,100,100 + x*36)
			TempTextIDs.Insert(ThisText)
		Next x

		Repeat
			CheckESC()
			For x = 0 to TempTextIDs.Length
				ThisTXT = TempTextIDs[x]
				If GetTextHitTest( ThisTXT, GetPointerX(), GetPointerY() ) //Hover
					SetTextColor(ThisTXT,255,128,0,255)
					If GetPointerPressed()
						Player$ = Saves[x].PlayerName$
							CurrentPlayer.PlayerName$ = Player$
							CurrentPlayer.Checkpoint = Saves[x].Checkpoint
							CurrentPlayer.Score = Saves[x].Score
						For t = TempTextIDs.Length to 0 Step -1
							DeleteText(TempTextIDs[t])
							TempTextIDs.Remove(t)
						Next t
					EndIf
				Else
					SetTextColor(ThisTXT,255,255,255,255)
				Endif
			Next x
			Sync()
		Until Player$ <> ""

	Else
		`NewPlayer() // feel free to add a NewPlayer() option above as a separate TextID that will trigger it
	EndIf
		
EndFunction 

Function LoadSaves()
	SetFolder("saves/")
	ThisFile$ = GetFirstFile()
	Repeat
		ThisFile = OpenToRead(ThisFile$)
			ThisString$ = ReadString(ThisFile)
			CloseFile(ThisFile)
		ThisSave as SaveData //PlayerName$|Checkpoint|Score
			ThisSave.PlayerName$ = GetStringToken( ThisString$, "|", 1 )
			ThisSave.Checkpoint = VAL(GetStringToken( ThisString$, "|", 2 ))
			ThisSave.Score = VAL(GetStringToken( ThisString$, "|", 3 ))

		Saves.Insert(ThisSave)
		
		ThisFile$ = GetNextFile()
	Until ThisFile$ = ""

EndFunction

Function GenerateSaves()
	ThisSave = OpenToWrite("saves/tom.dat")
		WriteString(ThisSave, "Tom" + "|" + STR(Random(1,10)) + "|" + STR(Random(1000,10000)) )
	CloseFile(ThisSave)
	
	ThisSave = OpenToWrite("saves/dick.dat")
		WriteString(ThisSave, "Dick" + "|" + STR(Random(1,10)) + "|" + STR(Random(1000,10000)) )
	CloseFile(ThisSave)
	
	ThisSave = OpenToWrite("saves/harry.dat")
		WriteString(ThisSave, "Harry" + "|" + STR(Random(1,10)) + "|" + STR(Random(1000,10000)) )
	CloseFile(ThisSave)
	//OpenBrowser(GetWritePath()+"/media/saves/")
EndFunction

Function CheckESC()
	If GetRawKeyState(27) then End
EndFunction

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:

human readable (and hackable). issue added to the repo: [url=https://forum.thegamecreators.com/outbound?url=https%3A%2F%2Fgithub.com%2FTheGameCreators%2FAGK-Studio%2Fissues%2F893">893

update: apparently the above is expected behavior (i remember otherwise but not the first time memory has failed me :/ )
Posted: 17th Oct 2021 19:08
hat 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.
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.
Posted: 17th Oct 2021 21:39
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
Posted: 17th Oct 2021 23:17
Virtual Nomad

Thank you,

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.

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.

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.
Posted: 18th Oct 2021 0:23
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
Posted: 18th Oct 2021 1:01
PartTimeCoder

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.

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.
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

+ Code Snippet
rope_1=createsprite(0)
SetSpriteSize(rope_1,50,10)
SetSpriteColor(rope_1,0,0,255,255)
SetSpritePosition(rope_1,1800,50)
SetSpritePhysicsOn(rope_1,1)

rope_2=createsprite(0)
SetSpriteSize(rope_2,50,10)
SetSpriteColor(rope_2,0,255,255,255)
SetSpritePosition(rope_2,1800,60)
SetSpritePhysicsOn(rope_2,2)

CreateRopeJoint( rope_1, rope_2, GetSpriteOffsetX(rope_1), GetSpriteOffsetY(rope_1), GetSpriteOffsetX(rope_2), GetSpriteOffsetY(rope_2), 1, 1 )


Posted: 18th Oct 2021 16:29
Use 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.
Posted: 18th Oct 2021 17:01
Well I changed it to world and still does not work correctly, doing the same thing.

+ Code Snippet
rope_1=createsprite(0)
SetSpriteSize(rope_1,50,10)
SetSpriteColor(rope_1,0,0,255,255)
SetSpritePhysicsOn(rope_1,1)
SetSpritePositionByOffset(rope_1,30,0)


rope_2=createsprite(0)
SetSpriteSize(rope_2,50,10)
SetSpriteColor(rope_2,0,255,255,255)
SetSpritePhysicsOn(rope_2,2)
SetSpritePositionByOffset(rope_2,30,60)

getxpos_1=GetSpriteXFromWorld( rope_1, GetSpriteOffsetX(rope_1),GetSpriteOffsetY(rope_1))
getypos_1=GetSpriteYFromWorld( rope_1, GetSpriteOffsetX(rope_1),GetSpriteOffsetY(rope_1))
getxpos_2=GetSpriteXFromWorld( rope_2, GetSpriteOffsetX(rope_2),GetSpriteOffsetY(rope_2))
getypos_2=GetSpriteYFromWorld( rope_2, GetSpriteOffsetX(rope_2),GetSpriteOffsetY(rope_2))

CreateRopeJoint( rope_1, rope_2,getxpos_1 , getypos_1, getxpos_2, getypos_2, 10, 1 )


EDIT

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

+ Code Snippet
rope_1=createsprite(0)
SetSpriteSize(rope_1,50,10)
SetSpriteColor(rope_1,0,0,255,255)
SetSpritePhysicsOn(rope_1,1)
SetSpritePositionByOffset(rope_1,30,0)


rope_2=createsprite(0)
SetSpriteSize(rope_2,50,10)
SetSpriteColor(rope_2,0,255,255,255)
SetSpritePhysicsOn(rope_2,2)
SetSpritePositionByOffset(rope_2,30,60)

CreateRevoluteJoint ( 1, rope_1, rope_2, 30, 0, 0 )