Discuss Scratch

AmFaiq
Scratcher
33 posts

How to make collisions

How to make collision???
set dont knowto1

Last edited by AmFaiq (July 31, 2021 12:18:07)

Dankiel_
Scratcher
100+ posts

How to make collisions

Of what type? are you making a platformer? top down?
AmFaiq
Scratcher
33 posts

How to make collisions

I am making a rpg
Yusei-Fudo
Scratcher
1000+ posts

How to make collisions

AmFaiq wrote:

I am making a rpg
Need more information than this.
JL2magill
Scratcher
20 posts

How to make collisions

AmFaiq wrote:

I am making a rpg
For what?
whenclickedsetRPG powerto1000000000000000000000000000000000000000000000000000000000000000
Lirey
Scratcher
100+ posts

How to make collisions

AmFaiq wrote:

How to make collision???
set dont knowto1
If it's from a Birdseye's view (Like the very old Pokémon games) you usually add a script like this:
iftouching Object?thenmoveTheamountyoumovedforwardsbutwitha-infrontsteps
But that can get tricky as you would always want the character to point in the direction as the object. So to avoid messing with rotation I usually create these for the movements:
ifkey wpressed?thenchangeybyTheamountyouwantiftouching Object?thenchangeybytheamountyouwantbutnegative
And for the s key you would input the opposite:
ifkey spressed?thenchangeybytheamountyouwantbutnegativeiftouching Object?thenchangeybyTheamountyouwant
For the A key you would do the same code as the S key except turn the Change Ys into Change Xs. For the D key you would do the same code as the W key except change the Change Ys code into Change Xs. Hope this helped, and sorry for any confusion! (Editing note: When making something negative add a - sign in front of the number)

Last edited by Lirey (Aug. 1, 2021 23:44:44)

AmFaiq
Scratcher
33 posts

How to make collisions

Thanks
NebulaGamingYT
Scratcher
1 post

How to make collisions

a
BettaBubbles20
Scratcher
40 posts

How to make collisions

Here is a simple collision engine.
whendkeypressedsetold xtoxpositionsetold ytoypositionchangexby10iftouchingwall?thengotox:oldxy:oldy

whenakeypressedsetold xtoxpositionsetold ytoypositionchangexby-10iftouchingwall?thengotox:oldxy:oldy

whenwkeypressedsetold xtoxpositionsetold ytoypositionchangeyby10iftouchingwall?thengotox:oldxy:oldy

whenskeypressedsetold xtoxpositionsetold ytoypositionchangeyby-10iftouchingwall?thengotox:oldxy:oldy

Like this? Visit my profile at @BettaBubbles20 to find lots of amazing games.

Powered by DjangoBB