My first Game - Android Platformer


#21

I have a waterfall of 14 single images, 8 same segments above each other. It works good, but if I run away and come back, it is messed up. The only solution I have is making my fourteen 110x64 to 110x512 graphics in photoshop.
For my river I have to copy more than 30 same 64px sprites in a row.
Maybe it would be a good idea if “Tiled Sprite” also allow sprite animations in the future.


#22

It is hard to tell how your waterfall looks in motion. But you could also achieve something similar by animating the y-offset of a tiled sprite like so:
waterfall.gif
The waterfall consists of two tiled images, one light and one dark blue which are placed on top of each other.


#23

@Wendigo Okay danke, probiere ich mal wenn ich wieder ein Problem damit hab. Jetzt habe ich erstmal den ganzen Wasserfall als eine Grafik gemacht, ist insgesamt nur 40kb größer. Hat dadurch dann zwar zwangsläufig ein z order Problemchen wenn man beim Wasserfall in den Fluss springt, aber das ist verschmerzbar.
Ein Video von der Preview recorden war sehr rücklig und pixlig, aber wenn du es dir kurz ansehn möchtest, hier meine Projektdateien. memu.ga/game2.zip

In Kommentar #69964 hat mir Lizard-13 eine Variable erklärt mit der man die Player Steuerung zeitweiße deaktivieren kann. Klingt soweit auch genau nach dem was ich brauch, und ist sicher oft praktisch wenn bestimmte Eingaben nur in bestimmten Situationen gehen. Allerdings weiß ich nicht wie ich “Actions: Move to the left” verwenden soll, da der Player ja seine Steuerung automatisch durch das Platformer Behavior und nicht durch einzelne Actions bekommt.


#24

Please don’t get offended but it’s an english forum, try to not write too much in other languages… btw the GD Discord server has a German channel :slight_smile:

First you have to deactivate the default controls in the platformer behavior settings, with this the arrows and shift/spacebar won’t work to move the character by default.
Then you’ve to use the actions to simulate a key pressed, in the platformer section there’re actions to stimulate left, right, jump, etc. It should look like:

Conditions: Left key is pressed Actions: Simulate pressing Left for Player
The same for other controls, and as you’re now controlling the movement with events you can put them all as sub-events of a parent event checking that the player can move :slight_smile:


#25

Ahh okay now it works. :slight_smile:

How can I change

Conditions: Variable inTown of player = 1 Actions: Do = player.Y(top) +32 to Y position of camera (layer: "Town")to

Actions: Do = player.Y(top) -130 to Y position of camera (layer: "Town") slowly?
It’s supposed to be a sunset.
I have tried a lot, so unfortunately I have to ask again.


#26

@Jack: I can’t download “memu.ga/game2.zip”. Could it be that you forgot to click on “Add the file” after choosing it as an attachment?


#27

It was on my own webspace but not declared as a link.
Now it’s as an attachment.


#28

I had a look at you game. The waterfall animation looks exactly the same as yours when you use “wa1.png” on a tiled sprite and shift the y-offset of the texture. But to my surprise I noticed that changing the opacity of tiled sprites is not possible. :frowning:
Nice graphics by the way, I really like your mountain/forest background. Very atmospheric. :slight_smile:


#29

Perfect thanks, so I save 13 images for the waterfall and 13 for the river :slight_smile:


#30

The Y axis works in reverse in GDevelop, so a position of -130 is actually above +32.

Anyway, to make the sun set just use a scene variable e.g. "sunset"in place of the 32 (give it a value of -130 at the start of the scene) and add another action that adds a certain amount to it every second. Something like the following will move the sun down by 1 pixel every second.

Actions: Do = player.Y(top) +Variable(sunset) to Y position of camera (layer: "Town") Do -1*TimeDelta() to variable sunset

If that’s too fast, change the 1 to 0.5 or 0.1 or whatever works.
To stop it at +32 just add a check for that as a condition (better to check if <33 than if =32) at the same time you are checking that the Variable inTown of player = 1.


#31

Works well, thank you :slight_smile:


#32

I added 3 times the same object with an animation, but they are not in sync. That’s the same problem I had at the waterfall.
Is it because I have too many sprites with animations in my scene? There are 35 with all collectibles.
coin.gif


#33

You can use the actions for say to your coins “Hey after x time you can go to the next frame” and this for all yours objects called coin.


#34

Are you adding the coins in the scene editor, or creating them with events?

If created in the scene editor they should be in sync, but you can check that they are all set to the same animation frame by clicking on each instance and looking at the bottom of the properties window. You could also force them all to the same animation frame in the “At beginning of the scene” event.

If you are creating them with events, then ones created at different times will often be out of sync, because they will be created with frame 0, but existing instances may be on any of the other frames. You could enforce synchronisation by first checking that another coin exists (check number of objects >0) , then use the select random object event and capture its current animation frame in a variable. Then create a new coin and set its animation frame using the variable.

Alternatively, you could create the new coin first, then use a “for each object” sub-event to set all coins (new and old) to animation frame zero to match it.

Some of these will look more glitchy than others.

Oh, and I recognise that player character sprite. :wink:


#35

In the editor, but now I have tried adding with action, the same result.
I found out that the problem only exists if the X position is higher than 5231. Mysterious! :nerd:
Now I try your tips.

Yah is one of the best and famous freebies :slight_smile: unfortunately no source files included :unamused:


#36

I have created a simple example.
The problem is not the absolute X position but the distance from Player Start to the coins. An action that set the frame to 1 or change the animation, works only if it is very close to the coins. (also not 100% perfect, some have a frame offset) If I run a bit away and come back, the animations are messed up again.
coinbug.zip (65.6 KB)


#37

[size=120]That’s how it works now.[/size]


#38

Okay now you can have a first look at my little game :slight_smile:
https://jackii.itch.io/jumpingjack
https://streamable.com/8wlrt


#39

How can I toggle this?
At every key press, not automatically from 1 to 0 to 1 forever.

Here the same


#40

[url]https://forum.gdevelop-app.com/t/on-off-button-for-background-music/14083/1] :wink: