Posted: 5th Oct 2021 22:08
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.
Posted: 6th Oct 2021 2:09
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
Posted: 6th Oct 2021 2: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.
Posted: 6th Oct 2021 4:44
I updated the first post with a little video of the first level. could not put in in the thread there.
Posted: 6th Oct 2021 5:05
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.
Posted: 6th Oct 2021 6: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
Posted: 6th Oct 2021 12:07
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?
Posted: 6th Oct 2021 20:30
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.
Posted: 10th Oct 2021 0: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

+ Code Snippet
for coinnumber=109 to 200
if coins_t [ coinnumber ].exsist=0 
coinnumber=	coinnumber+1
if coinnumber>199 then coinnumber=109
coins_t [ coinnumber ].exsist=1
endif	

if coins_t [ coinnumber ].exsist=1
RockX=getspritex(Rocks)
RockY=GetSpriteY(Rocks)	
CoinSprite(RockX+2,Rocky+3)		
endif

next coinnumber


creating the coins

+ Code Snippet
function CoinSprite(x,y)

for CoinsCollected=109 to 200
	
	
if coins_t [ CoinsCollected ].exsist=1	
	
createsprite(CoinsCollected,coins_1)
SetSpriteScale(CoinsCollected,0.03,0.03)
SetSpritePosition(CoinsCollected,x,y-5)
SetSpriteAnimation(CoinsCollected,128,128,6)
PlaySprite(CoinsCollected,10, 1, 1, 6)
setspritephysicson(CoinsCollected,2)
SetSpritePhysicsMass( CoinsCollected, 30 )
endif

next CoinsCollected



endfunction	


the array holding each rocks coin amount

+ Code Snippet
dim rock [ 100 ] as rocks
//-------------------------------------------------------------------------------//
//    Give each rock some coins
//-------------------------------------------------------------------------------//
rock [ 1 ].CoinAmount=5
rock [ 2 ].CoinAmount=5
rock [ 3 ].CoinAmount=1
rock [ 4 ].CoinAmount=5
rock [ 5 ].CoinAmount=5
Posted: 10th Oct 2021 3:22
this should get you going:
+ Code Snippet
// Project: RockCoin 
// Created: 2021-10-09
// By: Virtual Nomad
// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "RockCoin" )
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 ) 

Yellow = MakeColor(255,255,0)
DrawEllipse(8,8,8,8,Yellow,Yellow,1)
GLOBAL CoinImg
Render()
CoinImg = GetImage(0,0,16,16)

Type Rock
	ID, Coins, LastCoin#
EndType

GLOBAL Rocks as Rock []
For x = 0 to 4
	ThisRock as Rock
		ThisRock.ID = CreateSprite(0)	:	SetSpriteSize(ThisRock.ID,32,32)
			SetSpritePositionByOffset(ThisRock.ID,300 + x*100.0,650)
			SetSpritePhysicsOn(ThisRock.ID,1)	:	SetSpriteGroup(ThisRock.ID,-10)
		ThisRock.Coins = (Random(2,5))
	Rocks.InsertSorted(ThisRock)
Next x
		
Player = CreateSprite(0)	:	SetSpriteSize(Player,32,32)
SetSpritePositionByOffset(Player,200,700)	:	SetSpriteShapeCircle(Player, 0,0,16)
SetSpritePhysicsOn(Player,2)
SetSpritePhysicsCanRotate(Player,0)

SetPhysicsGravity(0.0,200)
do
	PX# = GetSpriteXByOffset(Player)	:	PY# = GetSpriteYByOffset(Player)
	Grounded = PhysicsRayCast( PX#,PY#,PX#,PY#+16.4)
	
	If GetButtonState(1) and Grounded then Jump# = -200 else Jump# = GetSpritePhysicsVelocityY(Player)
    If GetRawKeyState(27) then Exit
        
	SetSpritePhysicsVelocity(Player, GetJoystickX()*150.0, Jump#)

	If GetSpriteFirstContact(Player)
		Repeat
			ThisHit = GetSpriteContactSpriteID2()
			If ThisHit > 0 and Rocks.Find(ThisHit) > -1
				Rock = Rocks.Find(ThisHit)
				If Rock > -1 and Rocks[Rock].Coins > 0 And Rocks[Rock].LastCoin# + 0.5 < Timer()
					SpawnCoin(ThisHit)
					Rocks[Rock].Coins = Rocks[Rock].Coins -1
					Rocks[Rock].LastCoin# = Timer()
				EndIf
			EndIf
		Until GetSpriteNextContact() = 0
	EndIf


	Print("[A/D]=Move, [W/D]=Climb, [Space]=Jump")
	For x = 0 to Rocks.Length `Coins Left in Rock
		Print(Rocks[x].Coins)
	Next x

    Sync()
loop

Function SpawnCoin(Spr)
	ThisCoin = CreateSprite(CoinImg)
	x = GetSpriteXByOffset(Spr)	:	y = GetSpriteY(Spr)
	SetSpritePositionByOffset(ThisCoin, x,y-16)
	SetSpriteGroup(ThisCoin,-10)
	SetSpritePhysicsOn(ThisCoin,2)
	SetSpriteShapeCircle(ThisCoin,0,0,8)
	SetSpritePhysicsVelocity(ThisCoin,0,-100.0)
EndFunction



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.
Posted: 10th Oct 2021 6: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.
Posted: 10th Oct 2021 13:21
Here is a big update

Lots more to do
Posted: 13th Oct 2021 17:00
I feel like the gravity needs increased.
Posted: 14th Oct 2021 1:00
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.

+ Code Snippet
If Grounded=0 and PY#=<20 
SetPhysicsGravity( 0, 150 )
endif

If Grounded=1 and stopme=0
SetPhysicsGravity( 0, 100 )	
StopSprite( Player )
stopme=1
endif
Posted: 14th Oct 2021 1: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.
Posted: 14th Oct 2021 2:01
increase the players mass

Does mass affect the rate of fall?
Posted: 14th Oct 2021 2:28
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.
Posted: 14th Oct 2021 3:05
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,

decrease the dampening and he will fall faster

...it's going to affect a lot more that "falling".
Posted: 14th Oct 2021 3:32
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.

+ Code Snippet
If SetjumpTimer>0
SetSpritePhysicsVelocity(Player,PMoveX# + (GetJoystickX()*30.0) ,Jump#+SetjumpTimer)
endif
Posted: 14th Oct 2021 3:45
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!