IF k$ <> "W" THEN
IF LEN(k$) = 0 THEN type$ = "idle"
END IF
Hi Prithak,Thanks, the background isn't my work but the character is. BTW, I am a part time animator! Thanks for the help but I already seem to have figured it out, but it still has some bugs that I know how to fix :D
Nice graphics. Is that your own job? About the jump. The maximum jump height is frame 7, as I found out. So, for the animation to be smooth, you have to take the current time when you insert the first slide, that is, if the jump takes one second, you have to insert the first 7 frames within half a second. You need to watch this, for example, using TIMER or ON TIMER. Just with inserting the next image you will always find out how much the current timer is, or set a new one. This way, you will not affect the main program loop. At the same time, when inserting pictures 1 through 7, you reduce the size of the Y axis in order for the figure to go up, and after half of the jump it increases again in the same step to the original value. If the height of the jump is 50 pixels, then is one shift in the Y axis for jump 50/7. For better effect, you can add or remove a value in the X axis, depending on whether the move key is pressed, but unfortunately, if you want to combine pressed keys, forget to the INKEY$ and use _KEYHIT.
Hi PrithakThis mod didn't work for me, it just goes downwards and not upwards. The previous one works perfectly fine! And I think I understand what's going on in that little snippet. I'll change the code and see what I can do to change my game.
about feedbacks
1 here I attach a version srhinked with one linear counter for image index and looking just a little more into your code I code also for jumping leftward added to original jumping rightward
2. fixed the movement only changing the direction of looking of the character, now character moves toward if it looks already in that direction, changing direction no initial movement is made
3. when you change direction of looking of the character also if it x position changes only by 5 units it shifts more to left/right
But this is an image error.... if you see the sprites of the characters they have a large amount of white space on the right... except for the die routine.... so if you cut that white amount of space on the right making the same x dimension of each sprite of moving to left or right and to jump you can fix this bug
OK I play with TempodiBasic's mod (nice start!)THANK YOU!!! This was exactly what I needed! Now, let me change my code for instance!
Now when you press D the character walks right forever and if W is pressed it will jump.
Now to stop and idle the character press S, press W while idling and it will jump.
Now when you press A the characters walks left forever and if you press W it will jump while going left.Code: QB64: [Select]
'Prithak Adhikari 'Saugat Adhikari '--------------------------- 'A Project From '2/16/2019 'To '- '--------------------------- 'This project was created for 'us to collaborate with a game 'that we dreamt to made for 'some time! maxJump = 50 y = 500 ic = 1 '<<<<<<<<<<<<<<<<<< direction facing 1 for right 2 for left? NEXT i NEXT i NEXT i i = 0 bgx = 0 bgy = 0 bgx2 = 800 bgy2 = 600 ' IF k$ = "" AND type$ = "jump" THEN k$ = "W" 'IF k$ <> "W" THEN ' IF LEN(k$) = 0 THEN type$ = "idle" 'END IF a = a + 1 jump = jump + 1 dy = dy + minJump dy = dy - minJump ic = 2 b = b + 1 jump = jump + 1 dy = dy + minJump dy = dy - minJump x = x - 5 ic = 1 c = c + 1 jump = jump + 1 dy = dy + minJump dy = dy - minJump x = x + 5 'ELSEIF type$ = "jump" THEN ' d = d + 1 ' IF d > 14 THEN d = 1: type$ = "idle" ' IF d < 7 THEN ' dy = dy + minJump ' IF dy > maxJump THEN dy = maxJump ' ELSE ' dy = dy - minJump ' IF dy < 0 THEN dy = 0 ' END IF ' _PUTIMAGE (x, y - dy)-(x + 100, y + 100 - dy), jump&(d) _LIMIT 30
That's a lovely assignment, very clever teacher!OMG! THANK YOU SO MUCH! THIS WAS EXACTLY WHAT I HAD IN MY HEAD!!! Will you mind If I change the code a little bit and submit it to my teacher? :P
Here is my solution to the jump - I've changed "wasd" keys to arrow keys for my own convenience.Code: QB64: [Select]
' & aka lil vince 'Prithak Adhikari 'Saugat Adhikari '--------------------------- 'A Project From '2/16/2019 'To '- '--------------------------- 'This project was created for 'us to collaborate with a game 'that we dreamt to made for 'some time! y = 500 ic = 1 NEXT i NEXT i NEXT i i = 0 bgx = 0 bgy = 0 bgx2 = 800 bgy2 = 600 t = 0 direction = 1 base_y = y jump = 0 jump_i = 0 t = t + 1 x = x - 10 x = x + 10 'start jump sequence jump_i = 5 jump = 1 jump_i = jump_i - 1 y = y - 10 y = y + vy vy = vy + 0.5 vy = 0 jump = 0 _LIMIT 30
it just goes downwards and not upwards.I am hungry so also in this time I have eaten something...
This is a true sidescroller variant where the character remains stationary while the background moves. You can add obstacles and items based on value of variable x to create your map.Thanks for making this _Vince xD. No, I am not like flat on CHR$(3) + CHR$(22) it, but referencing it and making something of my own out of it :D. (i hope you see what I did there xD).
You are welcome to use the code as you wish
Edit: Hope I didn't just do your homework, careful submitting any code you did not write - review the policy on thatCode: QB64: [Select]
'Prithak Adhikari 'Saugat Adhikari '--------------------------- 'A Project From '2/16/2019 'To '- '--------------------------- 'This project was created for 'us to collaborate with a game 'that we dreamt to made for 'some time! y = 500 ic = 1 NEXT i NEXT i NEXT i i = 0 bgx = 0 bgy = 0 bgx2 = 800 bgy2 = 600 t = 0 direction = 1 base_y = y-100 y = base_y jump = 0 jump_i = 0 t = t + 1 x = x - 10 x = x + 10 'start jump sequence jump_i = 5 jump = 1 jump_i = jump_i - 1 y = y - 20 y = y + vy vy = vy + 0.8 y = base_y vy = 0 jump = 0 _LIMIT 30